Skip to content
This repository was archived by the owner on Jul 7, 2025. It is now read-only.
This repository was archived by the owner on Jul 7, 2025. It is now read-only.

Replace Esc key listeners with a CloseWatcher in supported browsers #694

@lukewarlow

Description

@lukewarlow

Currently components such as Dialogs can't be closed by platform specific close signals such as the back button / gesture on Android.

Using the new CloseWatcher API [1][2] (where supported) instead of an escape keydown event handlers would address this.

[1] https://html.spec.whatwg.org/multipage/interaction.html#the-closewatcher-interface
[2] https://developer.chrome.com/blog/new-in-chrome-120#close-watcher

https://close-watcher-demo.glitch.me/ - provides a good demo.

This would improve accessibility of primer as it would allow for screen reader users to easily dismiss primer components (close watcher supports the Talkback back gesture for example).

It would also improve consistency with the underlying platform as native html dialogs and popovers have this behaviour built in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions