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

Disabled element color inheritance #502

Merged

Conversation

magnificode
Copy link

As issues #349 and #339 explain, color inheritance applied to form elements creates some possible usability issues in certain scenarios (see http://codepen.io/anon/pen/FyhsL), and causes disabled form elements to appear as though they are enabled.

This removes the color: inherit; declaration and subsequent test to alleviate those issues.

Dominic Magnifico added 2 commits January 21, 2016 23:50
…area elements. Color inheritance here causes possible usability issues when working on black backgrounds with white text. Addresses necolas#349 and necolas#339.
@cvrebert
Copy link

Apparently #157 is the reason the inheritance was originally added.

@jonathantneal
Copy link
Contributor

The choice comment in #157 was “color inheritance for select is not consistent”, which was the argument for normalization.

The issue here is that it’s unsafe to assign color or background-color without also assigning the other. If the color is redefined as inherit then the background-color ought to be redefined as transparent. However, that’s less a normalization than it is a reset, and it destroys the default usability of a form control.

To do this right, we need to know the nearest non-transparent background color and its contrast color. Without also declaring the page background, we can’t begin to predict this.

I see 2 logical choices; either we 1. normalize page and form color schemes in Normalize.css, or 2. we leave opinionated color schemes to companion libraries like Bootstrap and Sanitize.css.

Normalize.css previously normalized page color but later removed it because it was not possible to safely address the problem that it was trying to avoid. The arguments for styling the page background and which element to style the page background have been discussed at length. Therefore, I suggest we leave opinionated color schemes to other libraries. Thoughts?

@magnificode
Copy link
Author

I agree, especially since the usage of color: inherit; on form elements creates some possibly significant usability issues and also makes it so disabled form elements appear enabled, it may be best to just remove it altogether.

That one declaration seems to have a pretty far reach...form elements are always a fun little gray area to work within 😜

jonathantneal added a commit that referenced this pull request Jan 23, 2016
…itance

Disabled element color inheritance
@jonathantneal jonathantneal merged commit feccd02 into necolas:master Jan 23, 2016
Totktonada added a commit to whatifrussian/website that referenced this pull request Oct 7, 2016
---- Summary ----

A text inside the issue form's textarea and the submit button should now
be gray when the element is disabled. Any other style changes are
unintentional and can be considered as bugs (if it looks worse then
before).

Despite some breaks are possible, my thought is that going forward with
actual normalize.css is good choice and any bugs will visible and
therefore will be fixed sooner or latter.

---- Details ----

The original intention was to get fix for color of disabled form's
elements from [1]. It removes `color: inherit` from rules for forms
elements, which affected enabled and disabled elements both. The
intention was to fix the issue form when some elements are disabled.

During testing of the new normalize.css I found that textarea is colored
black despite other text has some other default color (#2e3436). It's
maybe due to my browser has non-so-standard configuration (Firefox 47.0
with dark devedition theme enabled), but anyway it's possible user's
configuration. I added back `color: inherit` for issue form rules and
add `color: graytext` for disabled elements.

New normalize.css also replaces `font: inherit` for form elements with
choosen default (sans-serif, 100%, 1.15 line-height), see [2]. It
doesn't work well when the default font was replaced with some other.
So I added this rule back for the issue form.

There is one more found difference. Search form at the top of the page
cut from right side with the new normalize.css. It's due to reverting
the box-sizing rule, see [3]. I added back `box-sizing: content-box` to
the rules for search input element.

[1]: necolas/normalize.css#502
[2]: necolas/normalize.css#607
[3]: necolas/normalize.css#496
notriddle added a commit to notriddle/rust that referenced this pull request Sep 28, 2022
These rules were copied from normalize.css 3, and are mostly redundant.

* `optgroup` isn't used in rustdoc at all
* `textarea` is only used for the "copy" button, so it's not visible
* The remaining buttons and inputs mostly have styles set anyway.
* We should never be setting `color` without also setting the
  background to something. Otherwise, you get white-on-gray
  text. That seems to be [the reason] why `normalize.css` changed this.

[the reason]: necolas/normalize.css#502
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Sep 29, 2022
…, r=GuillaumeGomez

rustdoc: clean up "normalize.css 8" input override CSS

These rules were copied from normalize.css 3, and are mostly redundant.

* `optgroup` isn't used in rustdoc at all
* `textarea` is only used for the "copy" button, so it's not visible
* The remaining buttons and inputs mostly have styles set anyway.
* We should never be setting `color` without also setting the background to something. Otherwise, you get white-on-gray text. That seems to be [the reason] why `normalize.css` changed this.

[the reason]: necolas/normalize.css#502
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Sep 29, 2022
…, r=GuillaumeGomez

rustdoc: clean up "normalize.css 8" input override CSS

These rules were copied from normalize.css 3, and are mostly redundant.

* `optgroup` isn't used in rustdoc at all
* `textarea` is only used for the "copy" button, so it's not visible
* The remaining buttons and inputs mostly have styles set anyway.
* We should never be setting `color` without also setting the background to something. Otherwise, you get white-on-gray text. That seems to be [the reason] why `normalize.css` changed this.

[the reason]: necolas/normalize.css#502
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Sep 29, 2022
…, r=GuillaumeGomez

rustdoc: clean up "normalize.css 8" input override CSS

These rules were copied from normalize.css 3, and are mostly redundant.

* `optgroup` isn't used in rustdoc at all
* `textarea` is only used for the "copy" button, so it's not visible
* The remaining buttons and inputs mostly have styles set anyway.
* We should never be setting `color` without also setting the background to something. Otherwise, you get white-on-gray text. That seems to be [the reason] why `normalize.css` changed this.

[the reason]: necolas/normalize.css#502
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants