Skip to content
Open
Next Next commit
fix: Add consistency in button and item button component
  • Loading branch information
im3dabasia committed Mar 6, 2025
commit 03cf1a594a63bd246eb057588175a8de10b70d70
12 changes: 3 additions & 9 deletions packages/components/src/item-group/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ export const unstyledButton = ( as: 'a' | 'button' ) => {
color: ${ COLORS.theme.accent };
}

&:focus {
box-shadow: none;
outline: none;
}

&:focus-visible {
&:focus:not( :disabled ) {
box-shadow: 0 0 0 var( --wp-admin-border-width-focus )
${ COLORS.theme.accent };
// Windows high contrast mode.
outline: 2px solid transparent;
outline-offset: 0;
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 3px solid transparent;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I wasn't clear. What I meant in #67747 is that the focus should be consistent only when the Item is rendered as a Button components, that is for example: <Item as="button" { ...toggleProps }>. The as prop is passed here so that it could be used to distinguish the focus style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have corrected it. Previously, the style was applied to Items as 'button' or as 'a'.

After 0355271 the focus styles will be applied only on the button and otherwise it would default to the old style ie focus-visible for the other ItemGroup.

`;
};
Expand Down