-
Notifications
You must be signed in to change notification settings - Fork 231
fix(overlay): Programmatic clicks on elements outside of the overlay now registers #5670
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 9ce6b30 The changes in this PR will be included in the next version bump. This PR includes changesets to release 84 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📚 Branch Preview🔍 Visual Regression Test ResultsWhen a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:
Deployed to Azure Blob Storage: If the changes are expected, update the |
Tachometer resultsChromeoverlay permalinkbasic-test
directive-test permalink
element-test permalink
lazy-test permalink
Firefoxoverlay permalinkbasic-test
directive-test permalink
element-test permalink
lazy-test permalink
|
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.
Before we go further, we should make sure that modals should support outside clicks.
|
||
```javascript | ||
// Programmatic click outside will close the overlay | ||
function closeOverlayProgrammatically() { |
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.
From: https://w3c.github.io/aria/#aria-modal
The aria-modal attribute is used to indicate that the presence of a "modal" element precludes usage of other content on the page. For example, when a modal dialog is displayed, it is expected that the user's interaction is limited to the contents of the dialog, until the modal dialog loses focus or is no longer displayed.
When a modal element is displayed, assistive technologies SHOULD navigate to the element unless focus has explicitly been set elsewhere. Some assistive technologies limit navigation to the modal element's contents. If focus moves to an element outside the modal element, assistive technologies SHOULD NOT limit navigation to the modal element.
When a modal element is displayed, authors MUST ensure the interface can be controlled using only descendants of the modal element. In other words, if a modal dialog has a close button, the button should be a descendant of the dialog. When a modal element is displayed, authors SHOULD mark all other contents as inert (such as "inert subtrees" in HTML) if the ability to do so exists in the host language.
Clicking should not be allowed because keyboard focus outside the modal should not be allowed.
Tagging @jnurthen and @majornista on this one for their thoughts.
Description
This PR adds
allowOutsideClick
property for the external click registration behavior in thesp-overlay
component. The implementation verifies that programmatic clicks on elements outside of modal overlays properly register and close the overlay, while user-initiated clicks are prevented from doing so.Technical Details
External Click Behavior
The overlay component uses a focus trap for
modal
andpage
type overlays with special handling for external clicks:This configuration ensures:
Motivation and context
This bug came when
showModal()
api was changed todialog.show()
and this edge case was missed.Related issue(s)
Screenshots (if appropriate)
Author's checklist
Reviewer's checklist
patch
,minor
, ormajor
featuresManual review test cases
Manual Testing - Chrome, Firefox & Safari
Test Automation
Device review