Dialog doesn't prevent the execution of clickshortcuts behind it
See original GitHub issueWhen I create a view with a Shortcut Listener (Enter) on a button and the view opens a “Add XYZ Dialog” for some additional content - I would expect that I can create a second Shortcut Listener within the Dialog and the Dialog prevents that both Enter Shortcuts are executed.
Only the Shortcut Listener within the Dialog should be executed. Currently both Shortcuts are executed.
This creates weird side effects. Additionally any Dialog should be modal (WCAG) - that mean’s that interacting with the content behind it SHOULD BE impossible.
Vaadin: 14.1.19 Browser: FF 74
How to test:
- Click Open Dialog
- Press Enter
- 2 Notification are displayed. It should only be one visible
@Route("shortcut")
public class ShortcutBug extends VerticalLayout {
public ShortcutBug() {
add(new Button("Open Dialog", e -> {
Button myDialogButton = new Button("Hit Enter", event -> {
Notification.show("Enter was called", 2000, Position.TOP_START).addThemeVariants(NotificationVariant.LUMO_SUCCESS);
});
myDialogButton.addClickShortcut(Key.ENTER);
Dialog dialog = new Dialog(myDialogButton);
dialog.open();
}));
Button myNonDialogButton = new Button("Should not be called by the other Other Enter Shortcut", e -> {
Notification.show("ERROR: Enter was called", 5000, Position.TOP_START).addThemeVariants(NotificationVariant.LUMO_ERROR);
});
myNonDialogButton.addClickShortcut(Key.ENTER);
add(new Hr(), myNonDialogButton);
}
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (11 by maintainers)
Top Results From Across the Web
How to prevent the command prompt from closing after ...
I have a solution which can only apply on .cmd and .bat files: Open regedit and go to each one of: [HKEY_CLASSES_ROOT\batfile\shell\open\command] ...
Read more >How can I override the OnBeforeUnload dialog and replace it ...
The result is, there doesn't seem to be a way of assigning false to onbeforeunload to prevent it from the default dialogue.
Read more >Keyboard shortcuts - Visual Studio (Windows) | Microsoft Learn
Learn about the default keyboard shortcuts in Visual Studio that allow you to access a variety of commands and windows.
Read more >Visual Studio Shortcut Keys - VS Code shortcuts - Dofactory
# ; Ctrl + . or Shift+Alt+F10, Opens smart tag and resolves a wide array of suggested code refactorings ; Esc, Closes a...
Read more >The difference between 'return false;' and 'e.preventDefault();'
The you-may-not-know-this bit is that whenever an event happens on an ... a click will trigger on the outer box too, unless you...
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
Right, that sentence doesn’t make sense as router links can be inside the modal dialogs too and should thus work. I’ll slap the author with a large 🐟 and fix it
@pleku I personally would expect router link to work within the dialog but the following comment made me question myself 😃
Because the second sentence said “not inert = navigation could be allowed by using something else than router links”