carbon-design-system/carbon

[Feature Request]: Replace Esc key listeners with a CloseWatcher in supported browsers

Open

#15,387 opened on Dec 13, 2023

 (4 comments) (0 reactions) (0 assignees)JavaScript (1,733 forks)batch import
afrohackshacktoberfestneeds: community contributionpackage: reactproposal: acceptedtype: enhancement 💡

Repository metrics

Stars
 (7,442 stars)
PR merge metrics
 (Avg merge 9d 14h) (106 merged PRs in 30d)

Description

The problem

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

The solution

Using the new CloseWatcher API [1][2] (where supported) instead of an escape keydow event 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

Examples

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

Application/PAL

No response

Business priority

None

Available extra resources

No response

Code of Conduct

Contributor guide