question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dialog doesn't prevent the execution of clickshortcuts behind it

See original GitHub issue

When 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:

  1. Click Open Dialog
  2. Press Enter
  3. 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
plekucommented, Mar 3, 2021

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

1reaction
knoobiecommented, Mar 3, 2021

@pleku I personally would expect router link to work within the dialog but the following comment made me question myself 😃

        // When the UI is made inert, all router link navigation is
        // ignored. For the part of the UI that is not inert, navigation
        // could be allowed by using something else than router links (with
        // server side listeners).

Because the second sentence said “not inert = navigation could be allowed by using something else than router links”

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found