-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Focus border generated by createFocusOutlineStyle
can be cut/invisible when parent container is overflow: hidden
#31745
Comments
Hi @wfwf1997 👋🏻 I guess with current focus style implementation, where it's set as absolutely positioned border with some offset, it will be always cut by parent padding and overflow:hidden. It have to be solved where is the overflow property set. You can have a negative margin workaround on a parent container. In the case you provided, you can apply something like that to a parent div, where is the overflow property set: const useStyles = makeStyles({
hidden: {
...shorthands.overflow("hidden"),
...shorthands.margin("0", "-8px"),
...shorthands.padding("0", "8px"),
},
inlineFlex: {
display: "inline-flex",
},
}); You can also try to use |
Thanks @mainframev for your solution. I suppose this approach do work. But it may hard to find out and fix every occurence of such clipping in a large codebase. I wonder if we can change the implementation or design to make these borders not that easy to get clipped. |
no assignees Gentle ping that this issue needs attention. |
It seems that native outline styles by default also have this problem https://stackblitz.com/edit/vitejs-vite-nayfuf?file=src%2Fstyle.css,src%2Fmain.ts&terminal=dev Playing around with it I think what the user agent does is apply a default Perhaps we should consider a default outline offset for Fluent focus outlines like the user agent does |
I have a draft PR here #33097 that sets a -2px focus outline, this will resolve issues for the switch and checkbox examples provided in the repro since they do not have offsets set by default However this will do nothing for the slider unfortunately since the offset is explicitly set in code Lines 101 to 108 in ed7c93c
|
/azp run |
Library
React Components / v9 (@fluentui/react-components)
System Info
Are you reporting Accessibility issue?
yes
Reproduction
https://codesandbox.io/p/sandbox/vigorous-firefly-mnrppk
Bug Description
Actual Behavior
The focus border is partially visible, or not visible in some cases.
Expected Behavior
The focus border should always be fully visible.
Logs
No response
Requested priority
High
Products/sites affected
No response
Are you willing to submit a PR to fix?
no
Validations
The text was updated successfully, but these errors were encountered: