Revert dialog doesn't handle keyboard input as expected (reverts when you may mean cancel)
See original GitHub issueI’m fairly new to Mac OS so I may have misunderstood this, but I believe that <enter>
is supposed to always accept “the blue button” and <space>
accepts the “blue-bordered-item” which can be tabbed through.
On this dialog, if I tab to the “Discard changes” button and then press either <enter>
or <space>
it still seems to discard, but I expected one to cancel.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Keyboard: keydown and keyup
So if we want to track any input into an <input> field, then keyboard events are not enough. There's another event named input...
Read more >Keyboard Input Overview - Win32 apps
Key location 101/102 Enhanced keyboard Scan 1 make Scan 1 break
DO NOT USE 00 80
DO NOT USE E0_00 E0_80
1 ~ ` 29 A9...
Read more >How to detect when cancel is clicked on file input?
This is logic to determine if not when. You could add it to the change listener but then you still have OP's main...
Read more >Handling Events
Though we have ignored it so far, event handler functions are passed an argument: the event object. This object holds additional information about...
Read more >Building a dialog component - web.dev
A foundational overview of how to build color-adaptive, responsive, and accessible mini and mega modals with the element.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m a little confused - the linked comment suggests you want to follow macOS, but that doesn’t seem to be what’s happening. On macOS,
<enter>
does not do the button highlighted with<tab>
, it does the blue/default button.(I’m also not sure about the
reviewer-needs-to-reproduce
label?)Totally agree with your critique, it’s completely valid. We went back and forth on it and agree that there’s not a great answer, but ultimately decided that since
Cancel
will close the dialog, that behavior will be super confusing as well, and since it requires that a user explicitly tabs to the particular button prior to the click, they’ve signaled their intent sufficiently enough to depart from the macOS behavior in this very narrow case. Thanks again for the issue, it really helped us understand how to think about it.