carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.85k stars 1.81k forks source link

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

Open lukewarlow opened 10 months ago

lukewarlow commented 10 months ago

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

github-actions[bot] commented 10 months ago

Thank you for submitting a feature request. Your proposal is open and will soon be triaged by the Carbon team.

If your proposal is accepted and the Carbon team has bandwidth they will take on the issue, or else request you or other volunteers from the community to work on this issue.

github-actions[bot] commented 10 months ago

The Carbon team has accepted this proposal! Our team doesn't have the capacity to work on this now, so we are requesting community contributors. Please see the labels for roles that are needed. If you are willing to help out, comment below and we will get in touch!

tay1orjones commented 10 months ago

@lukewarlow Thanks for opening this up! I agree, this would be a nice progressive enhancement to the existing "escape to close" functionality implemented across multiple components.

I don't think we'll be able to take this on anytime soon but if someone from the community wants to take this up, I'm happy to discuss further details of what the implementation could look like.

mitulagr2 commented 1 week ago

I'll take this if you'd like!