calcite-modal: Option to prevent modal from returning focus when modal is removed from the DOM (when focus trap is enabled). #9369
Labels
0 - new
New issues that need assignment.
ArcGIS Dashboards
Issues logged by ArcGIS Dashboards team members.
calcite-components
Issues specific to the @esri/calcite-components package.
enhancement
Issues tied to a new feature or request.
impact - p2 - want for an upcoming milestone
User set priority impact status of p2 - want for an upcoming milestone
p - low
Issue is non core or affecting less that 10% of people using the library
spike
Issues that need quick investigations for time estimations, prioritization, or a quick assessment.
Milestone
Check existing issues
Description
Currently, when a modal with a focus trap is removed from the DOM, it refocuses on the previously active element. This causes issues when the modal is used to delete an item. After deletion, the focus trap attempts to refocus on the now-deleted item, leading to unintended scrolling behavior, especially when the item is in scrollable container.
Here's the workflow:
One solution could be to disable the focus trap during deletion. However, the
focusTrapDisabled
property is being deprecated according to this calcite issue.An alternative could be to use the
returnFocusOnDeactivate
boolean property in the focus trap to disable this behavior (internally in calcite).Acceptance Criteria
Ability to prevent a modal from automatically setting focus when disconnected from the DOM.
Relevant Info
Currently using
[email protected]
Which Component
calcite-modal
Example Use Case
The modal is being used to delete an item, so when the item is deleted, the focus trap will attempt to refocus on that item, causing some unintended behaviors. In our case, the item is in a scrollable list so the focus is causing the list to scroll in unintended ways.
If there was some way to disable this refocus behavior, then the unintended scrolling behavior could be prevented and we could control where the focus instead needs to go.
Priority impact
p3 - want for upcoming milestone
Calcite package
Esri team
ArcGIS Dashboards
The text was updated successfully, but these errors were encountered: