Skip to content

Commit 1dc6622

Browse files
authored
fix(react-nav): Inset focus outlines to fix focus borders being cut off. (#34603)
1 parent 711fcf8 commit 1dc6622

File tree

4 files changed

+12
-13
lines changed

4 files changed

+12
-13
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "fix(react-nav): Inset focus outlines to fix focus borders being cut off",
4+
"packageName": "@fluentui/react-nav-preview",
5+
"email": "jiangemma@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-nav-preview/library/src/components/AppItem/useAppItemStyles.styles.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export const useAppItemStyles = makeStyles({
2020
gap: '10px',
2121
marginInlineStart: '-6px',
2222
marginInlineEnd: '0px',
23-
marginTop: '2px',
2423
padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS} ${tokens.spacingVerticalS} ${tokens.spacingHorizontalMNudge}`,
2524
...typographyStyles.subtitle2,
2625
},

packages/react-components/react-nav-preview/library/src/components/NavDrawerHeader/useNavDrawerHeaderStyles.styles.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { useDrawerHeaderStyles_unstable } from '@fluentui/react-drawer';
44
import type { SlotClassNames } from '@fluentui/react-utilities';
55
import type { NavDrawerHeaderSlots, NavDrawerHeaderState } from './NavDrawerHeader.types';
66

7-
import { navDrawerBodyClassNames } from '../NavDrawerBody/useNavDrawerBodyStyles.styles';
8-
97
export const navDrawerHeaderClassNames: SlotClassNames<NavDrawerHeaderSlots> = {
108
root: 'fui-NavDrawerHeader',
119
};
@@ -19,10 +17,6 @@ const useStyles = makeStyles({
1917
paddingInlineStart: '14px',
2018
paddingBlock: '5px',
2119
},
22-
23-
[`${navDrawerBodyClassNames.root} + ${navDrawerHeaderClassNames.root}`]: {
24-
marginTop: '-2px',
25-
},
2620
});
2721

2822
/**

packages/react-components/react-nav-preview/library/src/components/sharedNavStyles.styles.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ export const useRootDefaultClassName = makeResetStyles({
5656
':hover': {
5757
backgroundColor: navItemTokens.backgroundColorHover,
5858
},
59-
':active': {
60-
zIndex: 1,
61-
backgroundColor: navItemTokens.backgroundColorPressed,
62-
},
63-
':focus': {
64-
zIndex: 1,
59+
60+
// Use custom insert focus indicator
61+
'&:focus-visible': {
62+
outline: `${tokens.strokeWidthThick} solid ${tokens.colorStrokeFocus2}`,
63+
outlineOffset: `calc(${tokens.strokeWidthThick} * -1)`,
6564
},
6665
});
6766

0 commit comments

Comments
 (0)