Open niklasdahlheimer opened 2 years ago
Hey @niklasdahlheimer and thanks for the suggestion! Actually, SelectField
is not the only one that doesn't have that - the same goes for all sorts of checkboxes and radio inputs. I'd rather add a readonly
attribute rather than a class, but I think it's enough for your use case (and this case in general).
Update: it looks like some themes (e.g., Bootstrap) have custom styles for readonly
<select>
s, so it actually affects more themes. Pull requests welcome, as usual!
I need to add custom text styling to readonly fields. For TextFields this works flawlessly with a selector like
because the readonly attribute is forwarded directly to the
<input>
element. However, for SelectFields the inner HTML element is<select>
. You probably did not forward it here because, according to the specification<select>
elements do not accept the readonly attribute.To respect the specification but still have an anchor for readonly select fields and support css selecting, it would be great if you could add a conditional
readonly
class to the outer div, similar to thedisabled
class, here: https://github.com/vazco/uniforms/blob/f19cdcb67a09bb20c8e3618d5211d01eeaf95bf9/packages/uniforms-semantic/src/SelectField.tsx#L51PS: I only could speak for the semantic-ui package here, maybe this affects other packages too.