Skip to content
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 - [Modal] - models incorrectly mark dom nodes with aria-hidden="true" #11041

Open
christianvogt opened this issue Sep 20, 2024 · 0 comments

Comments

@christianvogt
Copy link
Contributor

Describe the problem
Modal components incorrectly update the aria-hidden attribute of the root and siblings.

When a modal is open, the root and all siblings should have aria-hidden="true" except for the modal container.

When using React.StrictMode along with a useEffect somewhere in the app hierarchy, the double rendering effect of strict mode causes the open modal to have aria-hidden="true" when it shouldn't.

Also when using React.StrictMode a new div is appended to the DOM which is never removed until the page is refreshed.

Finally if there are multiple Modals rendered with isOpen={false} and one of them is opened, the root and all siblings lose their attribute aria-hidden="true".

When using Cypress for testing, selectors will fail to find elements within a hidden element if aria-hidden="true". This prevents our developers from using cypress against a dev env and allowing them to develop and run their cypress tests against their dev app.

How do you reproduce the problem?
Here's a sandbox with all the use cases.
https://codesandbox.io/s/withered-frog-qc67dn?file=/index.js

Expected behavior
Using React.StrictMode should have no bearing on the correct functionality of the Modal component. It should work as expected in or out of this mode.

Is this issue blocking you?
Yes.
Unable to run our cypress tests within a development environment which is using React.StrictMode.

Work around is to edit the app and remove strict mode however that is not a viable solution all the time.
Alternatively, devs can run cypress against a production build which takes much longer to iterate with during development.

What is your product and what release date are you targeting?
RHOAI

Any other information?

@tlabaj tlabaj added this to the 2024.Q4 milestone Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: On deck
Development

No branches or pull requests

2 participants