[web] Workaround for removing aria-hidden leftovers#580
Merged
Conversation
When a PF4/Modal is unmounted instead of set as `isOpen={false}`, its
siblings remain as `aria-hidden`. To know more read
patternfly/patternfly-react#9096
09a942f to
8ca1cbc
Compare
Pull Request Test Coverage Report for Build 5005255927
💛 - Coveralls |
dgdavid
added a commit
that referenced
this pull request
Oct 19, 2023
It's no longer needed in PatternFly React >= 5.1.1 which merged the patch sent. Read more: * patternfly/patternfly-react#9110 * patternfly/patternfly-react#9096 * https://github.com/patternfly/patternfly-react/releases/tag/v5.1.1
dgdavid
added a commit
that referenced
this pull request
Oct 19, 2023
It's no longer needed in PatternFly React >= 5.1.1 which merged the patch sent. Read more: * patternfly/patternfly-react#9110 * patternfly/patternfly-react#9096 * https://github.com/patternfly/patternfly-react/releases/tag/v5.1.1
dgdavid
added a commit
that referenced
this pull request
Oct 19, 2023
[web] Remove Popup#aria-hidden patch added in #580
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When an
isOpen={true}PF4/Modal is unmounted instead of set asisOpen={false}, its siblings remain asaria-hidden. To know more, read following linksfix(Modal): remove
aria-hiddenfrom siblings when unmounting the component patternfly/patternfly-react#9096, the fix sent to upstreamBug - Modal - aria-hidden is not removed after closing modal-based form patternfly/patternfly-react#8925, the issue already reported to upstream by someone else
[web] Blur and grayscale
aria-hiddenandinertdiv nodes #564, the RFC where we were aware about the issue[PoC]: Stop rendering unmounting modals directly #576, an attempt to see how difficult it would be to stop unmounting these dialogs and switch them to their close state instead.
componentDidUpdatemethod which is directly manipulating the DOM. Thus, the first dialog rendered as open adds thearia-hiddenattribute to its siblings but subsequent not open dialogs will remove the same attribute from the same siblings.We have been told by the Patternfly team that the patternfly-react repo is code frozen and the fix will be reviewed for the next release, in Q3 at the earliest.
Solution
To use a workaround meanwhile: removing the
aria-hiddenattributes from thedocument.bodychildren when the Agama/Popup will be unmounted.Why not using a
refto ask for its siblings instead, as we did in #572 for the similar behavior of theSidebar? Because PF4/Modal does not forward the ref. Read https://react.dev/learn/manipulating-the-dom-with-refs#accessing-another-components-dom-nodesThere are other tricky ways to workaround the issue (such as looking for the element with backdrop open CSS class 😵 😶), but since Agama is not using the
appendToPF4/Modal prop it is enough removing the attribute from the default target children.Testing
Screenshots
N/A