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

Polish focus styles #3401

Merged
merged 8 commits into from
Nov 14, 2017
Merged

Polish focus styles #3401

merged 8 commits into from
Nov 14, 2017

Conversation

jasmussen
Copy link
Contributor

@jasmussen jasmussen commented Nov 9, 2017

This is a rather mammoth PR to improve focus styles across the board. Outside of the switch styles, which need more work and should be addressed separtely, this fixes #3382 and fixes #3039.

The impetus for this design is that we use a lot of "naked" components. Movers, ellipsis menus, icon-only buttons, which when given the traditional focus style appear immaterial. By giving a considered style and background, it gives solidity to the button.

Because it's a mammoth PR that touches everything at once, I've been able to reduce and trim a ton of styles, move many of the focus styles into mixins for reusability, and I've overall been able to do a ton of consistency work using SCSS variables. Border radii, menu item paddings, focus styles and alignments should all improve as of this.

On the downside, we should test this PR pretty thoroughly.

Edit: Forgot to mention — this PR also both unifies and changes the hover style. It's now very dark gray everywhere, except for formatting controls where there's still that 1px border.

I like this, I think it works, but there's not a lot of visual contrast between neutral and hover states now. I don't think it's a problem, but I wanted to surface it in case others do.

Screenshots:

screen shot 2017-11-09 at 11 38 22
screen shot 2017-11-09 at 11 38 28
screen shot 2017-11-09 at 11 38 32
screen shot 2017-11-09 at 11 38 38
screen shot 2017-11-09 at 11 38 42
screen shot 2017-11-09 at 11 38 46
screen shot 2017-11-09 at 11 38 54
screen shot 2017-11-09 at 11 38 58
screen shot 2017-11-09 at 11 39 02
screen shot 2017-11-09 at 11 39 07
screen shot 2017-11-09 at 11 39 14
screen shot 2017-11-09 at 11 39 21

@jasmussen jasmussen added [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). General Interface Parts of the UI which don't fall neatly under other labels. [Type] Enhancement A suggestion for improvement. labels Nov 9, 2017
@jasmussen jasmussen self-assigned this Nov 9, 2017
@youknowriad
Copy link
Contributor

Awesome work. It's working pretty well globally.

Two questions:

  • The in-between blocks inserter has a different style, maybe you forgot about it?
  • Do we really need the "double" border on focus styles: the inner white and the black border. I think it may look better if we drop the white. Personal opinion though. (Maybe aside when we have both toggled and focus style at the same time)

@@ -110,9 +110,7 @@ function BlockSwitcher( { blocks, onTransform } ) {
} }
className="editor-block-switcher__menu-item"
icon={ (
<span className="editor-block-switcher__block-icon">
Copy link
Contributor

Choose a reason for hiding this comment

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

The block icon is not always a dashicon, this wrapper was necessary to correctly add the spacing between the icon and text when we have custom elements as icons. Not saying we shouldn't remove it but it was there on purpose and we should make sure it doesn't break. #3238

I think you're targetting svg but block icons are not always svg, they can be anything.

@jasmussen
Copy link
Contributor Author

The in-between blocks inserter has a different style, maybe you forgot about it?

I did, thanks!

Do we really need the "double" border on focus styles: the inner white and the black border. I think it may look better if we drop the white. Personal opinion though. (Maybe aside when we have both toggled and focus style at the same time)

I think we do, as there are apparently some very specific requirements around contrast between shapes and backgrounds, and the background itself doesn't count as a shape.

But since we are moving this all to mixins, adjusting these in the future if we find that we can, should be easier to do in one place instead of 20 different scss files.

I restored the span and fixed things with a different approach. Good catch, Riad, thank you!

@jasmussen
Copy link
Contributor Author

Rebased. I think this is ready for a final pair of eyes. CC: @mtias @karmatosed

Joen Asmussen added 7 commits November 14, 2017 14:13
This is a work in progress. Pushing so I can continue work from the coworking space.
- Improve toggles, search fields
- Cleaner separation of code for borderradii
Also improve radius consistency further.
- Styles the in-between inserter focus style
- Fix some issues with the block-docked toolbar stacking left-borders
- Restore the icon span to the transformer, and re-do style neutralization.
@jasmussen
Copy link
Contributor Author

Got a thumbs up in chat. Merging.

@jasmussen jasmussen merged commit a1ff0f3 into master Nov 14, 2017
@jasmussen jasmussen deleted the polish/focus-styles branch November 14, 2017 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). General Interface Parts of the UI which don't fall neatly under other labels. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve menus styling consistency Adjust and redesign neutral, hover, active and focus states
2 participants