-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Try: Make input styles consistent #5605
Conversation
I'll take a closer look at this tonight most likely. One thing I've noticed is that you are specifically targeting |
Thanks. Not urgent.
Indeed, I forgot that. This is one of the reasons it's good to test these blanket override styles, and make sure we do it only because it's the right thing to do. |
Core specifically targets every input type individually rather than doing a straight
https://github.com/WordPress/WordPress/blob/master/wp-admin/css/forms.css#L7 I'd imagine when it comes to merging this with core it might be a question of whether input styles are adjusted globally rather than Gutenberg specific. |
I've tested the branch out and have found a few errors which the highly specific nature of just scoping the global Range field: Inline link field: Button link field: Checkbox fields (These are fine actually, but just for reference on how these look now): Radio fields (These are fine too, but just to show how they look now): Moving forward I guess scoping It might be a browser specific thing (I'm using Safari), however I've noticed the line-height of the shortcode field and those in the sidebar seems to differ, and makes the sidebar ones seem quite squashed from the y axis. I'd recommend adding a Screenshot of before and after for reference: Maybe it's personal preference, or if there's something to consider from a usability/accessibility perspective, however I think I actually preferred the more focal focus style where the input border would turn blue with a bit of box-shadow to make it stand out more. It makes it a lot more obvious where your current input focus is rather than turning the input a slighter darker shade of grey. I kind of like the style which wordpress.com uses. Screenshot for reference: |
Thanks for the feedback. I'll continue to refine this PR (and agree with your notes) 🌟 |
Okay, pushed some more fixes: These two are unchanged, though: Gutenberg inputs can now opt into the "Gutenberg" input style by applying the class But pushing now for discussion and thoughts. |
I think this is great and a good step in consistency. |
A note to self to maybe also look at improving the color of placeholder text. That is, ensuring that it looks like placeholder text, but still maintaining sufficient contrast. Could mean making non-placeholder text darker. |
7b9b7b3
to
f200057
Compare
Squashed and rebased this. Took a look at placeholder text, but turns out we've already styled the placeholder text to be as light a gray as AAA contrast allows ($dark-gray-300 is the lightest we can use). CC: @ryelle do you know if we can use a lighter-than-AAA for placeholder text? Asking because in an incoming PR, we show image dimensions as placeholder text when unset. For example for a 400x300px image that does not yet have explicit
☝️ but because those values are unset, they'd be light gray and |
Any reason for the class name of |
No reason, other than it's the upstream WordPress form field class as far as I can tell. |
As long as all the input fields and textareas have a visible, properly associated |
@jasmussen on Safari, when I click on the "Document" or "Block" buttons (the "tabs") in the sidebar, i see the buttons text color changes to white while clicking (as far as I can tell it's the Safari default for buttons in the active state). I don't think it's related to this PR though. |
This is unrelated. I've been seeing this since day 1 pretty much. 😄 |
6ac4fee
to
bd56a38
Compare
I've rebased, squashed, polished, fixed tests, and I believe this is ready to go. In the last commit, ee70ff6, I also override core styles. We do this because if we don't, we can't fix #4963, because the editor itself relies so on textfields. We could replicate the same styles in the slimmer scope, but as suggested in this thread it might be worth looking at new styles that are more compatible with the general Gutenberg design, and then submit these upstream as well. Alternately, we can revert that last commit. Screenshots: @paulwilde another look? Thank you! |
@jasmussen Just tried it out, looks good. If I had any nitpicks, it would be to change the focus outline to $blue-medium-600 (#00a0d2) as the grey against the light blue looks a little dull to me. However I don't mind too much either way. Additionally (although it doesn't bother me as much) I think the left/right padding of 10px is a little too deep for what are somewhat small inputs text size wise. Reducing it down 1 or 2 pixels looks better and then keeps it consistent with |
ee70ff6
to
04f2041
Compare
Maybe fixes #4963. This takes a stab at unifying all basic input fields to inherit and have the same styles. That includes blocks that use input fields, and input fields in the sidebar, for example the alt text on an image block. Blocks using the PlainText component (which is intentionally unstyled by default) can apply a `regular-text` style that is inherited from upstream. This is now applied to the Shortcode block, which also gets a visual enhancement.
04f2041
to
4ac7ad6
Compare
Great thoughts, @paulwilde, thanks!
Here's $blue-medium-600: Did you mean 300? Which looks like this: (I used the 300 blue, let me know if you meant something else) I took your suggestion for the padding. Good to go? |
@jasmussen Sorry, by outline I mean the 1px border around the actual input when its in focus. It seems to be a CSS If you zoom in between my 2 images you should notice what I mean. So change the focus style to be:
Then I think everything looks good to go. 👍 |
🎉 |
Maybe fixes #4963.
This takes a stab at unifying all basic input fields to inherit and have the same styles. That includes blocks that use input fields, and input fields in the sidebar, for example the alt text on an image block.
Blocks using the PlainText component (which is intentionally unstyled by default) can apply a
regular-text
style that is inherited from upstream. This is now applied to the Shortcode block, which also gets a visual enhancement.While I believe this PR is a definite enhancement and adds much needed consistency, it should also get many eyes as it unstyles some upstream styles in order to achieve the goal. For example upstream input fields get a glowing blue border, and a drop shadow inside. This unstyles that to achieve consistency in Gutenberg.
As such, before I spend too much time on this, we should decide:
Depending on discussions, I will amend this PR. CC: @paulwilde
Border styles were also darkened slightly, CC #5482 and @afercia.