Skip to content

Don't open dropdown on ESC on trigger element#28912

Merged
patrickhlauke merged 2 commits into
v4-dev-xmrfrom
patrickhlauke-dropdown-no-open-on-esc
Jun 17, 2019
Merged

Don't open dropdown on ESC on trigger element#28912
patrickhlauke merged 2 commits into
v4-dev-xmrfrom
patrickhlauke-dropdown-no-open-on-esc

Conversation

@patrickhlauke

Copy link
Copy Markdown
Member

Closes #28751

(doesn't need porting to v5, as there the issue doesn't appear to be present anymore)

@Johann-S

Copy link
Copy Markdown
Member

How is it possible it's not present in v5 ? 😲

Comment thread js/src/dropdown.js
@patrickhlauke

patrickhlauke commented Jun 17, 2019

Copy link
Copy Markdown
Member Author

How is it possible it's not present in v5 ? 😲

no idea. all i know is that when i tried running current v5, it didn't exhibit the behavior (unless i messed up somewhere along the line). note that the whole handling of stuff there has subtly changed in v5...so more as an accident than intention, i think, this problem went away (but now, closing a dropdown doesn't seem to set focus back to the dropdown toggle, which is a new and exciting problem...sigh)

@Johann-S

Copy link
Copy Markdown
Member

I'm very surprise the v5 code follow the v4 code, it shouldn't have such difference, is it possible for you to list what changed between v4 and v5 ?

@patrickhlauke

patrickhlauke commented Jun 17, 2019

Copy link
Copy Markdown
Member Author

I'm very surprise the v5 code follow the v4 code, it shouldn't have such difference, is it possible for you to list what changed between v4 and v5 ?

incidentally, i just added the new unit test to the clean master here locally, and ran the tests ... and they all passed. will dig deeper into why v5 is unaffected...

[edit] unit test in v5: #28913

@Johann-S

Copy link
Copy Markdown
Member

Thanks @patrickhlauke 👍 Let me know if you have any questions about the v5 code

@XhmikosR XhmikosR changed the base branch from v4-dev to v4-dev-xmr June 17, 2019 13:10
patrickhlauke added a commit that referenced this pull request Jun 17, 2019
@patrickhlauke

Copy link
Copy Markdown
Member Author

Thanks @patrickhlauke 👍 Let me know if you have any questions about the v5 code

without digging too deeply, one change that seems relevant is that in dropdown.js in v4 on line 484 it triggers a "click" (which happens on keydown for ESC as well) whereas in v5 on the matching line 492 is does Dropdown._clearMenus() which, from what I can see, does all sorts of extra sanity checking.

@patrickhlauke

Copy link
Copy Markdown
Member Author

and for reference, the new issue i found in v5 #28914

@Johann-S

Copy link
Copy Markdown
Member

Hmm true, nice catch, I don't remember why we made that change 🤔

@patrickhlauke

Copy link
Copy Markdown
Member Author

Hmm true, nice catch, I don't remember why we made that change 🤔

well, a real button already reacts to all the appropriate things like SPACE and ENTER to open the dropdown (by firing the click event), so unnecessary for that. this leaves keydown reaction when menu is already open, which can really only be cursor keys and esc (plus special cases where somebody stuck an input/textarea in the menu itself) ... so i guess this makes more sense.

@patrickhlauke patrickhlauke merged commit 120a39f into v4-dev-xmr Jun 17, 2019
@patrickhlauke patrickhlauke deleted the patrickhlauke-dropdown-no-open-on-esc branch June 17, 2019 13:52
XhmikosR pushed a commit that referenced this pull request Jun 18, 2019
* Don't open dropdown on ESC on trigger element

Closes #28751
XhmikosR pushed a commit that referenced this pull request Jun 18, 2019
* Don't open dropdown on ESC on trigger element

Closes #28751
XhmikosR pushed a commit that referenced this pull request Jun 25, 2019
@mdo mdo mentioned this pull request Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants