fix(react-nav): Inset focus outlines to fix focus borders being cut off. #34603
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previous Behavior
The original focus outline fix changed two things:
AppItem
s, and added a -2px top margin to the drawer header.Neither of these behaviors are ideal, unfortunately. If for example a partner wants to include more than one
AppItem
inside theirNav
, they would have an extra 2px margin on their secondAppItem
. If they didn't want to include anAppItem
or wanted to add it somewhere besides the top of theNav
, the first item in theNav
would be cut off.For the added zIndex: as Mason said, we don't want to bake in z indexes to shared components because product code often has their own z indexing strategy that can clash with ours.
New Behavior
A safer approach with less potential impact to partners to fixing the issue of focus border being cut off would be to make the focus borders inset instead. This way there is lower impact to customers who want to use controls differently than the way they are set up in the storybook. We have used the inset focus outline approach in the Fluent AI
CopilotNav
as well as other similar controls.Related Issue(s)