Record View Row Not Collapsing When Dependency Based Field Is Defined as Read-Only

Field Vardef:

  'rate_guarantee' =>    array (       'required' => false,       'name' => 'rate_guarantee',       'vname' => 'LBL_RATE_GUARANTEE',       'type' => 'int',       'massupdate' => false,       'default' => '',       'no_default' => false,       'comments' => '',       'help' => '',       'importable' => 'true',       'duplicate_merge' => 'enabled',       'duplicate_merge_dom_value' => '1',       'audited' => false,       'reportable' => true,       'unified_search' => false,       'merge_filter' => 'disabled',       'full_text_search' =>           array (               'enabled' => '0',               'boost' => '1',               'searchable' => false,           ),       'calculated' => false,       'len' => '2',       'size' => '20',       'enable_range_search' => false,       'disable_num_format' => '',       'min' => false,       'max' => false,       'readonly' => true,       'dependency' => 'not(equal($rating_method,"shelf_rated"))',   ),

Typically, the "dependency" property causes the field to display/hide on the Record View and if there are no other visible fields on the same row, the row will collapse. However, setting the "readonly" property to true prevents the row from collapsing.

I have tried placing the readonly property in the vardefs.php file and the record.php file and the row will not collapse.

If I remove the readonly property from the vardef, leaving the dependency property as-is, and add a ReadOnly Dependency Action (https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Architecture/Sugar_Logic/Dependency… ) which only makes the field read-only when it is visible, the row collapses when the field is hidden, but the field is not read-only when it is visible.

Has anyone else run into this problem? And more importantly, has anyone found a solution?