Skip to content

Commit

Permalink
[Page Actions] Remove shadow on focus states for buttons in Page Head…
Browse files Browse the repository at this point in the history
…er (#10582)

### WHY are these changes introduced?

Linked to Shopify/web#104248

We have noticed that the focus states for the actions in the Page Header
do not match the focus states for other buttons within Polaris. They
have a darker background, and an inset shadow. This should be the
`:active` state, not the `:focus-visible` state.

### WHAT is this pull request doing?

This PR is updating the visuals of the actions within the Page Header,
namely the breadcrumbs and actions.

- We set the `:focus` style to match the `:hover` style, to bring this
in line with other Button components.
- We include new `:focus-visible` style rules to remove the box shadow
for the page actions
- We change the existing `:focus` styles to `:active`, as these styles
should be applied when the page actions are pressed


### How to 🎩

🖥 [Local development
instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development)
🗒 [General tophatting
guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md)
📄 [Changelog
guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog)

Storybook:
https://5d559397bae39100201eedc1-kvktrdbvcr.chromatic.com/?path=/story/all-components-page--default&globals=polarisSummerEditions2023:true


### 🎩 checklist

- [x] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
- [x] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [x] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
- [x] Updated the component's `README.md` with documentation changes
- [x] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide
  • Loading branch information
mrcthms committed Sep 22, 2023
1 parent 63cf3ad commit 3efbc1b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/purple-sheep-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Fixed the focus states of actions within the Page Header component
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,16 @@
background-color: var(--p-color-bg-strong) !important;
border-radius: var(--p-border-radius-2) !important;
/* stylelint-disable-next-line selector-max-combinators -- se23 */
&:hover {
&:is(:hover, :focus) {
background-color: var(--p-color-bg-strong-hover) !important;
}
/* stylelint-disable-next-line selector-max-combinators -- se23 */
&:focus,
&:active {
background-color: var(--p-color-bg-strong-active) !important;
box-shadow: var(--p-shadow-inset-md) !important;
}
/* stylelint-disable-next-line selector-max-combinators -- se23 */
&:focus:not(:active) {
&:focus-visible {
/* stylelint-disable-next-line polaris/border/polaris/at-rule-disallowed-list -- se23 */
@include no-focus-ring;
outline: var(--p-border-width-2) solid
Expand All @@ -94,11 +93,10 @@
button {
color: var(--p-color-text-critical) !important;
/* stylelint-disable-next-line selector-max-combinators, max-nesting-depth -- se23 */
&:hover {
&:is(:hover, :focus) {
background-color: var(--p-color-bg-strong-hover) !important;
}
/* stylelint-disable-next-line selector-max-combinators, max-nesting-depth -- se23 */
&:focus,
&:active {
background-color: var(--p-color-bg-strong-active) !important;
}
Expand Down
11 changes: 8 additions & 3 deletions polaris-react/src/components/Page/components/Header/Header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ $action-menu-rollup-computed-width: 40px;
box-shadow: none;

/* stylelint-disable-next-line selector-max-combinators -- SE23 match button group */
&:hover {
box-shadow: none;
&:is(:hover, :focus, :focus-visible) {
/* stylelint-disable-next-line declaration-no-important -- SE23 match button group */
box-shadow: none !important;
}

/* stylelint-disable-next-line selector-max-combinators -- SE23 match button group */
&:is(:hover, :focus-visible) {
background-color: var(--p-color-bg-strong-hover);
}

/* stylelint-disable-next-line selector-max-combinators -- SE23 match button group */
&:focus {
&:active {
background-color: var(--p-color-bg-strong-active);
/* stylelint-disable-next-line declaration-no-important -- SE23 match button group */
box-shadow: var(--p-shadow-inset-md) !important;
Expand Down

0 comments on commit 3efbc1b

Please sign in to comment.