Skip to content

Conversation

adamwathan
Copy link
Member

We noticed that in Chrome, disabled <select> elements were being rendered at 70% opacity, but were being rendered at 100% opacity in Firefox and Safari. After some research, we learned that all form controls in all browsers are rendered at a lower opacity when disabled if you don't include our other Preflight styles, but some of the other normalizations we do in Preflight (specifically stuff around borders) causes each browser to abandon their default/native control styles, and only Chrome persists the user-agent opacity setting it was using for the untouched native control.

This PR just sets the opacity for all disabled elements to 1 so that there are no surprises and you can style your disabled elements however you want. This is something we ran into on Catalyst, and had to add disabled:opacity-100 to our select controls to avoid since we had our own custom styles for them.

@adamwathan adamwathan requested a review from a team as a code owner November 13, 2024 16:03
Copy link
Contributor

@thecrypticace thecrypticace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed one thing that looks broken

color: inherit;
}
::file-selector-button:where() {
Copy link
Contributor

@thecrypticace thecrypticace Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely wrong. Maybe this is a lightningcss bug? Looks like it works in Lightning's playground so we should probably work on upgrading.

Maybe split the selector in preflight temporarily to work around it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah good catch. Noticing other stuff that's kinda in this same category of fixes, like input elements get a different background color when disabled too. Not sure how far to go with this stuff, tricky.

@philipp-spiess
Copy link
Member

The changes in this PR are included in #15036

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants