Skip to content

Commit

Permalink
fix(react-menu): use outline for menuItem focus ring (#28685)
Browse files Browse the repository at this point in the history
* use outline

* chg
  • Loading branch information
YuanboXue-Amber authored Jul 31, 2023
1 parent d4b3fee commit 9250428
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: use css outline for MenuItem focus ring instead of pseudo element",
"packageName": "@fluentui/react-menu",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mergeClasses, makeStyles, shorthands } from '@griffel/react';
import { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';
import { createFocusOutlineStyle } from '@fluentui/react-tabster';
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
import { tokens } from '@fluentui/react-theme';
import { useCheckmarkStyles_unstable } from '../../selectable/index';
import type { MenuItemCheckboxState } from '../MenuItemCheckbox/index';
Expand All @@ -17,7 +17,18 @@ export const menuItemClassNames: SlotClassNames<MenuItemSlots> = {
};

const useStyles = makeStyles({
focusIndicator: createFocusOutlineStyle(),
focusIndicator: {
':focus': {
outlineStyle: 'none',
},
':focus-visible': {
outlineStyle: 'none',
},
...createCustomFocusIndicatorStyle({
...shorthands.borderRadius(tokens.borderRadiusMedium),
...shorthands.outline(tokens.strokeWidthThick, 'solid', tokens.colorStrokeFocus2),
}),
},
// TODO: this should be extracted to another package
root: {
...shorthands.borderRadius(tokens.borderRadiusMedium),
Expand Down

0 comments on commit 9250428

Please sign in to comment.