-
Notifications
You must be signed in to change notification settings - Fork 77
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
Popover - When clicked outside of a focus trap, focus is not returned to the element prior to the focus trap #10682
Comments
The way our focus trapping works is that when the focus trap is deactivated via click outside or escape, focus is returned to the element focused prior to opening the focus-trap. In this case, this would be the expand button. I think what Maps SDK is asking for is that clicks outside deactivate the focus trap but do not return focus to the element prior to focus trapping. But when hitting escape, it does return focus to the element previously focused. I think we may need a spike and do some research here. |
This could be conditional on whether the focus was explicitly moved to a different element, if we can detect or signal that. In the case of the JSAPI, the problem happens when the focus is moved to the view but then reset back to the expand button. If there was a way to detect that the focus switched to the view, then we could stop the default focus trap behavior of going back to expand button. |
Yeah we can probably do this. |
May be resolved by #10522, blocking to confirm after the efforts are completed. |
Issue #10522 has been closed, this issue is ready for re-evaluation. |
This was not addressed in the fix mentioned above, will work towards a resolution in an upcoming milestone. |
…cus-trap (#11453) **Related Issue:** #11345 ## Summary Adds `focusTrapOptions` option to allow additional customization of focus-trapping components. It supports the following options from https://github.com/focus-trap/focus-trap#createoptions: * `initialFocus` – would replace popover's internal initialFocusTrapFocus prop * `allowOutsideClick` – supports #10682 * `returnFocusOnDeactivate` – supports #10682 And the following custom prop: * `extraContainers` – allows specifying extra elements (nodes or selectors) to focus trap (e.g., anything appending to the body, etc) when creating/activating the trap. **Note**: if specified, elements must exist when the focus trap is activated, if extra containers are created afterwards, users can use `updateFocusTrapElements(extraContainers)` This also enhances `updatesFocusTrapElements()` to accept extra containers to allow in the focus trap if these are created after the trap is activated. ### Notes * A subset of https://github.com/focus-trap/focus-trap#createoptions options are exposed as certain configurations might break component functionality. * `extraContainers` gets used both when creating and updating the focus trap target containers * Tidies up types
…cus-trap (#11453) **Related Issue:** #11345 ## Summary Adds `focusTrapOptions` option to allow additional customization of focus-trapping components. It supports the following options from https://github.com/focus-trap/focus-trap#createoptions: * `initialFocus` – would replace popover's internal initialFocusTrapFocus prop * `allowOutsideClick` – supports #10682 * `returnFocusOnDeactivate` – supports #10682 And the following custom prop: * `extraContainers` – allows specifying extra elements (nodes or selectors) to focus trap (e.g., anything appending to the body, etc) when creating/activating the trap. **Note**: if specified, elements must exist when the focus trap is activated, if extra containers are created afterwards, users can use `updateFocusTrapElements(extraContainers)` This also enhances `updatesFocusTrapElements()` to accept extra containers to allow in the focus trap if these are created after the trap is activated. ### Notes * A subset of https://github.com/focus-trap/focus-trap#createoptions options are exposed as certain configurations might break component functionality. * `extraContainers` gets used both when creating and updating the focus trap target containers * Tidies up types
Check existing issues
Summary
When the
esc
key is pressed when the calcite popover is open, it will always close the popover, even if the focus is elsewhere in the web page.When clicked outside of the focus trap (like on the map for example), we would expect the
esc
key to no longer affect the popover, at least until the focus is returned to that element.Ideal behavior:
Currently, in both of the scenarios above, focus is returned to the element prior to the focus trap. It seems like we may want different things depending on if the focus trap is deactivated due to a click vs escape key press.
Actual Behavior
The
esc
key will always close the popover, even if the focus is no longer on the popover.The focus will always return to the element prior to the focus trap, even if it is deactivated due to a click elsewhere.
Expected Behavior
When clicked outside of a focus trap, the focus should not be returned to the element prior to the focus trap.
Reproduction Sample
https://codepen.io/driskull/pen/zYgaNQP
Reproduction Steps
Reproduction Version
2.13.2
Working W3C Example/Tutorial
No response
Relevant Info
related JS SDK issue: https://devtopia.esri.com/WebGIS/arcgis-js-api/issues/66350#issuecomment-5110811
Regression?
No response
Priority impact
impact - p3 - not time sensitive
Calcite package
Esri team
ArcGIS Maps SDK for JavaScript
The text was updated successfully, but these errors were encountered: