Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
ItemGroup: Apply focus state to Item component rendered as anchor e…
…lement
  • Loading branch information
t-hamano committed Jul 11, 2023
commit 48a9691a913350f8c925cd2434c844c8aa08668f
2 changes: 1 addition & 1 deletion packages/components/src/item-group/item/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function useItem( props: WordPressComponentProps< ItemProps, 'div' > ) {
const classes = useMemo(
() =>
cx(
as === 'button' && styles.unstyledButton,
( as === 'button' || as === 'a' ) && styles.unstyledButton,
styles.itemSizes[ size ] || styles.itemSizes.medium,
styles.item,
spacedAround && styles.spacedAround,
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/item-group/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const unstyledButton = css`
cursor: pointer;
background: none;
text-align: start;
text-decoration: none;

svg,
path {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
fill: $gray-700;
}

&:is(a) {
text-decoration: none;
display: flex;
align-items: center;

&:focus {
box-shadow: none;
outline: none;
}
Comment on lines -34 to -37
Copy link
Member

Choose a reason for hiding this comment

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

It looks like we still need to keep this reset, because the :focus state gets triggered (without being overridden by a :focus-visible state) when you click on the link:

The anchor item gets a light blue box-shadow when clicked

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This focus style seems to be derived from WP-Admin's common.css.

common

I think it would be better to resolve this at the component level, so I will move this focus style to the component.

}

&.with-suffix {
padding-right: $grid-unit-20;
}
Expand Down