senaite / senaite.core

Enterprise Open Source Laboratory System (LIMS)
https://senaite.com
GNU General Public License v2.0
254 stars 145 forks source link

Fix subfield_sizes have no effect when rendering RecordField #2504

Closed xispa closed 8 months ago

xispa commented 8 months ago

Description of the issue/feature this PR addresses

This Pull Request adds the subfield_widths property to RecordField so it has precedence over size attribute.

System sets the value for size attribute properly when rendering input elements. However, there are some css rules (either coming from bootstrap and defined in senaite css - see https://github.com/senaite/senaite.core/blob/2.x/webpack/app/scss/forms.scss#L55-L56 -) that apply a width to input elements.

As stated at https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/size , If CSS targets the element with properties impacting the width, CSS takes precedence.. Therefore, the values set for subfield_sizes are always omitted.

This Pull Request adds the attribute subfield_widths to overcome this limitation, but keeps subfield_sizes as a fallback for backwards compatibility in case subfields_widths is not set.

Current behavior before PR

The values set for subfield_sizes have no effect

Captura de 2024-02-26 16-12-28

Desired behavior after PR is merged

The values set for subfield_sizes have effect

Captura de 2024-02-26 16-11-36

-- I confirm I have tested this PR thoroughly and coded it according to PEP8 and Plone's Python styleguide standards.