Skip to content

Commit

Permalink
Add background color to menu items being hovered (#13732)
Browse files Browse the repository at this point in the history
* Add background color to menu items being hovered

This PR adds some clarity to which menu item you're highlighting. It:

- Adds a background color to a menu item hovered
- Increases the contrast (opacity) of the keyboard shortcut indicator when hovering
- It widens the hit are of the button to go edge to edge

It's a relatively small PR, but it's a really nice improvement to have.

* Darken other hover colors to match.

* Address feedback.

* Apply to font size picker too.
  • Loading branch information
jasmussen authored and youknowriad committed Mar 6, 2019
1 parent b841a32 commit 0432dd9
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
3 changes: 2 additions & 1 deletion assets/stylesheets/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
color: $dark-gray-900;
border: none;
box-shadow: none;
background: $light-gray-200;
}

@mixin menu-style__focus() {
Expand All @@ -226,7 +227,7 @@
}

@mixin block-style__hover {
background: $light-gray-100;
background: $light-gray-200;
color: $dark-gray-900;
}

Expand Down
8 changes: 5 additions & 3 deletions packages/components/src/autocomplete/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@
flex-grow: 1;
flex-shrink: 0;
align-items: center;
padding: 6px;
padding: 6px 8px;
margin-left: -3px;
margin-right: -3px;
text-align: left;

&.is-selected {
@include button-style__focus-active;
@include menu-style__focus;
}

&:hover {
@include button-style__hover;
@include menu-style__hover;
}
}
8 changes: 8 additions & 0 deletions packages/components/src/font-size-picker/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
top: calc(50% - 10px);
left: 10px;
}

&:hover {
@include menu-style__hover;
}

&:focus {
@include menu-style__focus;
}
}

.components-font-size-picker__buttons .components-font-size-picker__selector {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/menu-group/style.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.components-menu-group {
width: 100%;
padding: $grid-size - $border-width;
padding: ($grid-size - $border-width) 0;
}

.components-menu-group__label {
margin-bottom: $grid-size;
color: $dark-gray-300;
padding: 0 ($grid-size - $border-width);
}
12 changes: 8 additions & 4 deletions packages/components/src/menu-item/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.components-menu-item__button,
.components-menu-item__button.components-icon-button {
width: 100%;
padding: 8px;
padding: $grid-size ($grid-size-large - $border-width);
text-align: left;
color: $dark-gray-600;

Expand All @@ -24,6 +24,10 @@
@include break-medium() {
@include menu-style__hover;
}

.components-menu-item__shortcut {
opacity: 1;
}
}

&:focus:not(:disabled):not([aria-disabled="true"]) {
Expand All @@ -39,15 +43,15 @@
.components-menu-item__info {
margin-top: $grid-size-small;
font-size: $default-font-size - 1px;
opacity: 0.82;
opacity: 0.84;
}

.components-menu-item__shortcut {
align-self: center;
opacity: 0.5;
opacity: 0.84;
margin-right: 0;
margin-left: auto;
padding-left: 8px;
padding-left: $grid-size;

// Hide the keyboard shortcuts on mobile, because they aren't super-useful
// for most mobile users and it frees up screen space for any item
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/panel/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
// Hover States
.components-panel__body > .components-panel__body-title:hover,
.edit-post-last-revision__panel > .components-icon-button:not(:disabled):not([aria-disabled="true"]):not(.is-default):hover {
background: $light-gray-100;
background: $light-gray-200;
}

.components-panel__body-toggle.components-button {
Expand Down
7 changes: 3 additions & 4 deletions packages/editor/src/components/block-settings-menu/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
}

.editor-block-settings-menu__content {
padding: $grid-size - $border-width;
padding: ($grid-size - $border-width) 0;
}

.editor-block-settings-menu__separator {
margin-top: $grid-size;
margin-bottom: $grid-size;
margin-left: -$grid-size + $border-width;
margin-right: -$grid-size + $border-width;
margin-left: 0;
margin-right: 0;
border-top: $border-width solid $light-gray-500;

// Check if the separator is the last child in the node and if so, hide itself
Expand All @@ -36,7 +36,6 @@
.editor-block-settings-menu__control {
width: 100%;
justify-content: flex-start;
padding: 8px;
background: none;
outline: none;
border-radius: 0;
Expand Down

0 comments on commit 0432dd9

Please sign in to comment.