-
Notifications
You must be signed in to change notification settings - Fork 1.2k
The VisuallyHidden component from the React Aria library breaks styling under certain conditions #5094
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
Comments
Yep, I see the issue. It also doesn't work with Tab keyboard navigation. An option for you to fix it in your app: As for solutions we can apply: Otherwise, we'd need to create a wrapping element around the VisuallyHidden which has position relative on it with a height and width of 0. I think this may cause a problem with assistive techologies though. We'll have to try it out and consult with our accessibility team. It may also be positioned incorrectly within the "Checkbox" depending on where various elements have been positioned visually. |
Setting |
Just hit this as well. Occurs when I have a radio group and I select a radio option that is inside of overflow scroll. Completely destroys my whole page layout until I wrap my radio group with <div style={{position: "relative"}}>... or add |
I think this would cause a potentially confusing VO cursor as it would appear as though the entire page (or whatever parent has position: relative) is "focused". You should put position relative on the root of the component that the VisuallyHidden is for, such as Checkbox's outer most div. Then you can safely use
I think moving the position relative to the Radio would be better than the RadioGroup, otherwise it could be confusing to AT users as the elements would all potentially be stacked in one place. The best thing for us to do is include some information on the page for VisuallyHidden https://react-spectrum.adobe.com/react-aria/VisuallyHidden.html#visuallyhidden and maybe on components using VisuallyHidden as well. |
I just ran into this issue as well. I have a |
I cannot access the code sandbox to verify this, but I recently wrote a short article about this which may be helpful https://filip-wachowiak.vercel.app/blog/default-absolute-positioning-in-a-scroll-container |
Provide a general summary of the issue here
The
VisuallyHidden
component fromreact-aria
, used as described by the documentation, breaks page styling at certain viewport dimensions. Namely, if the element that it's being used with is offscreen and needs to be scrolled to in order to be interacted with, doing so will break the height and flex flow of the parent container in some strange way.🤔 Expected Behavior?
Using the
VisuallyHidden
component should have no effect on the rest of the page.😯 Current Behavior
Interacting with a component that uses
VisuallyHidden
breaks the surrounding page layout under the conditions mentioned above and shown in the below example.💁 Possible Solution
No response
🔦 Context
Using the component as described by the documentation breaks my application's styling, something which took a good chunk of time to pinpoint. The
VisuallyHidden
component should only hide its children nodes and have no effect on the rest of the DOM.🖥️ Steps to Reproduce
Checkbox
component - the one that does not break the styling - applies adisplay: none
rule to theinput
element in order to hide it, rather than using theVisuallyHidden
component fromreact-aria
. Observe that theCheckboxWithVisuallyHidden
component does useVisuallyHidden
, and that interacting with that version of the checkbox breaks the page.Version
"react-aria": "^3.28.0",
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
MacOS Ventura 13.3.1
🧢 Your Company/Team
No response
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: