-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] close popins with escape #1094
Conversation
6b967a0
to
38e7c72
Compare
e.preventDefault(); | ||
if (e.code === "Escape") { | ||
if (this.state.opened) { | ||
const popins = [].slice.call(document.querySelectorAll("[data-focus='popin']")).reduce((prec, current) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[...document.querySelectpr]
|
1cc0e33
to
f2bbe5e
Compare
if (this.state.opened) { | ||
const popins = [...document.querySelectorAll("[data-focus='popin']")].reduce((prec, current) => { | ||
if (current.hasChildNodes()) { | ||
prec.push(Number(current.getAttribute('data-level'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+
2efce0c
to
357c29d
Compare
*/ | ||
handleKeyDown(e) { | ||
e.preventDefault(); | ||
if (e.code === "Escape") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Escape'
I don't see why the level cannot be a |
In the Popin code example, the popins are created in the render method of the parent. To handle the z-order, the level property needs to be updated when the popins toggle to visible state. At that time, the prop level cannot be changed so I had to create a state level.
|
eb52aef
to
30f9ea1
Compare
30f9ea1
to
6b4ae85
Compare
Popin closed with esc
Description
issue #824 :
Escape, in order to close each and every opened panel (and popin and such).
Meaning we have to keep track of the order in which popins have been opened to close them in reverse order.
the z-order of the popins is managed with the data-level attribute. The view is responsible of attributting a new level each time a popin is opened.
Example