Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Resolve issue where input text is hard to read in dark theme #1009

Merged
merged 1 commit into from
Oct 12, 2016
Merged

Resolve issue where input text is hard to read in dark theme #1009

merged 1 commit into from
Oct 12, 2016

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Oct 8, 2016

Fixes #1008

background: #ccc;
}
input.raw_input::-moz-selection {
background: #999;
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why this is different from the ::seletion rule

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's an excellent question! I noticed that the color of the selected text in the input field differs in Chrome and Firefox when using background: #ccc;. In Firefox, the selected text was not easy to read with background: #ccc; , so I used background: #999; instead. Thinking about this a bit more, I agree that these should not differ. I'll see if I can figure out the root cause so that we can keep the selected text colors the same.

Firefox with background: #ccc;
firefox_1

Chrome with background: #ccc;
chrome_1

Firefox with background: #999;
firefox2_1

Copy link
Contributor Author

@parthea parthea Oct 10, 2016

Choose a reason for hiding this comment

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

I've pushed a new version using rgba() based on this StackOverflow post.

::selection is not in the official CSS spec, but it was published in a draft of Pseudo-Elements Level 4.

From Mozilla Developer Network,

Gecko is the only engine requiring the prefix. Due to the fact that the CSS parsing rules require dropping the whole rule when encountering an invalid pseudo-element, two separate rules must be written: ::-moz-selection, ::selection {...}. The rule would be dropped on non-Gecko browsers as ::-moz-selection is invalid on them.

Copy link
Contributor

@yebrahim yebrahim Oct 10, 2016

Choose a reason for hiding this comment

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

Awesome! Thanks for the investigation and fix. It would actually be great if we can merge the two CSS rules into one that takes both selectors. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would actually be great if we can merge the two CSS rules into one that takes both selectors.

Unfortunately, the following didn't work in my testing.

input.raw_input::selection, input.raw_input::-moz-selection {
  background: rgba(85, 85, 85, 0.99);
}

The following snippet from Mozilla Developer Network also reaffirms the test result:

Due to the fact that the CSS parsing rules require dropping the whole rule when encountering an invalid pseudo-element, two separate rules must be written..

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh CSS! Well thanks Anthonios.

@ojarjur ojarjur merged commit 9061774 into googledatalab:master Oct 12, 2016
@ojarjur
Copy link
Contributor

ojarjur commented Oct 12, 2016

Sorry for the delay getting this merged; for some reason it seems that GitHub never triggered the webhook to trigger the automated checks, so the required commit statuses never got set.

@parthea parthea deleted the issues/issue_1008 branch October 12, 2016 22:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants