-
Notifications
You must be signed in to change notification settings - Fork 67
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
feat: POC for isHidden prop on ModalDialog #2431
base: master
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for paragon-openedx ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
<ModalBackdrop onClick={onClickOutside} /> | ||
{children} | ||
{!isHidden && <ModalBackdrop onClick={onClickOutside} />} | ||
<div className={classNames({ 'd-none': isHidden })}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: we should avoid using CSS utility classes with !important
in Paragon components; define a custom .pgn__
namespaced class name to use instead with display: none;
to be more theme-able.
zIndex ? `zindex-${zIndex}` : '', | ||
)} | ||
className={classNames({ | ||
'pgn__modal-layer': isOpen && !isHidden, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[inform] Conditionally include the pgn__modal-layer
class name only when the modal contents and the backdrop should actually be visible. Without making this class name conditional, the resulting div
from FocusOn
acts a non-clickable overlay.
@@ -52,29 +52,31 @@ function ModalLayer({ | |||
}; | |||
}, [isOpen]); | |||
|
|||
if (!isOpen) { | |||
if (!isOpen && !isHidden) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[consideration] It's possible this conditional could remain unchanged given isOpen
would need to be truthy for isHidden
to work anyways.
<Portal> | ||
<FocusOn | ||
allowPinchZoom | ||
scrollLock | ||
enabled={isOpen} | ||
enabled={isOpen && !isHidden} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FocusOn
is used in ModalDialog
to handle the accessibility of auto-focus on the first interactive element in the modal and handling the Esc
keypress or backdrop click.
Description
Demos a proof-of-concept of updating the
ModalDialog
component to introduce anisHidden
prop for the following types of use cases:Deploy Preview
https://deploy-preview-2431--paragon-openedx.netlify.app/components/modal/modal-dialog/
Testing instructions:
div
in the DOM with an id ofparagon-portal-root
containing a hidden modal with theisHidden
prop. Even though its in the DOM, it's not visible on the screen until theisHidden
prop is changed from truthy to falsey.paragon-portal-root
React portal DOM element seems to be OK but would likely need more confirmation.Merge Checklist
example
app?wittjeff
andadamstankiewicz
as reviewers on this PR.Post-merge Checklist