Skip to content

Popover - When clicked outside of a focus trap, focus is not returned to the element prior to the focus trap #10682

@annelfitz

Description

@annelfitz

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:

  • When escape is pressed, focus is returned to the element prior to the focus trap
  • When clicked outside of a focus trap, focus is not returned to the element prior to the focus trap

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

  1. open the popover
  2. press escape
  3. notice the button is focused
  4. open the popover
  5. click outside of the popover
  6. notice the button is focused
  7. click again outside of the popover and the focus on the button is now gone.

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/calcite-components
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/eslint-plugin-calcite-components

Esri team

ArcGIS Maps SDK for JavaScript

Metadata

Metadata

Labels

4 - verifiedIssues that have been tested, confirmed as mitigated, and are ready to close.ArcGIS Maps SDK for JavaScriptIssues logged by ArcGIS SDK for JavaScript team members.a11yIssues related to Accessibility fixes or improvements.bugBug reports for broken functionality. Issues should include a reproduction of the bug.estimate - 5A few days of work, definitely requires updates to tests.impact - p3 - not time sensitiveUser set priority impact status of p3 - not time sensitivep - mediumIssue is non core or affecting less that 60% of people using the library

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions