Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readonly class to SelectField #1148

Open
niklasdahlheimer opened this issue Jul 17, 2022 · 2 comments
Open

Add readonly class to SelectField #1148

niklasdahlheimer opened this issue Jul 17, 2022 · 2 comments
Assignees
Labels
Area: Theme Affects some of the theme packages Theme: Semantic UI Affects the uniforms-semantic package Type: Feature New features and feature requests
Milestone

Comments

@niklasdahlheimer
Copy link

niklasdahlheimer commented Jul 17, 2022

I need to add custom text styling to readonly fields. For TextFields this works flawlessly with a selector like

.ui.input input[readonly]{
   color: darkgrey;
}

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 the disabled class, here:

className={classnames({ disabled, error, required }, className, 'field')}

PS: I only could speak for the semantic-ui package here, maybe this affects other packages too.

@radekmie radekmie self-assigned this Jul 21, 2022
@radekmie radekmie added Area: Theme Affects some of the theme packages Theme: Semantic UI Affects the uniforms-semantic package labels Jul 21, 2022
@radekmie radekmie added this to the v3.x milestone Jul 21, 2022
@radekmie radekmie added the Type: Feature New features and feature requests label Jul 21, 2022
@radekmie
Copy link
Contributor

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).

@radekmie
Copy link
Contributor

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!

@radekmie radekmie modified the milestones: v3.x, v4.0 Oct 7, 2022
@kestarumper kestarumper assigned kestarumper and unassigned radekmie Oct 18, 2022
@radekmie radekmie moved this to To do in Open Source Nov 18, 2022
@kestarumper kestarumper modified the milestones: v4.0, v4.x Apr 12, 2024
@piotrpospiech piotrpospiech moved this from To do to On Hold in Open Source Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Theme Affects some of the theme packages Theme: Semantic UI Affects the uniforms-semantic package Type: Feature New features and feature requests
Projects
Status: On Hold
Development

No branches or pull requests

3 participants