You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a tricky bug discovered on version 13.0.3 and also 13.0.2
Button button;
ShortcutRegistration shortcutRegistration;
public void init() {
button = new Button();
button.setText("Reactivate shortcut");
button.addClickListener(event -> shortcutRegistration = buildShortcut());
button.setEnabled(false);
add(button);
add(new TextField());
shortcutRegistration = buildShortcut();
Button otherButton = new Button();
otherButton.setText("a button with shortcutlistener");
otherButton.addClickListener(event -> new Notification("Shortcut B has been triggered", 1000).open());
// Disable the following line to make it works! :/
otherButton.addClickShortcut(Key.KEY_B);
add(otherButton);
}
private ShortcutRegistration buildShortcut() {
return Shortcuts.addShortcutListener(this, () -> {
new Notification("Shortcut C has been triggered", 1000).open();
shortcutRegistration.remove();
button.setEnabled(true);
}, Key.KEY_C);
}
I add a "button", a basic textfield and an "otherButton" in my page.
I also define 2 shortcuts:
"KEY_C" on my page: when this one is triggered, it will remove itself => should be triggered only once but it can be "reactivate" by clicking on "button".
"KEY_B" as clickShortcut on my otherButton: it does nothing special, it's just a shortcut :)
When the page is loaded, I focus the textfield and I press "c"
=> Shortcut KEY_C is triggered and should be removed. The letter "c" doesn't appear in my textfield.
As expected, if a press again "c", because Shortcut KEY_C has been removed, the letter "c" should appear in my textfield but it's not the case.
I make a lot of investigation to understand what's going on and I finally discovered the cause of this bug: the line otherButton.addClickShortcut(Key.KEY_B);
If you comment it, the shortcut KEY_C will be correctly removed.
Tricky one... :-)
The text was updated successfully, but these errors were encountered:
Hello!
This is a tricky bug discovered on version 13.0.3 and also 13.0.2
I add a "button", a basic textfield and an "otherButton" in my page.
I also define 2 shortcuts:
When the page is loaded, I focus the textfield and I press "c"
=> Shortcut KEY_C is triggered and should be removed. The letter "c" doesn't appear in my textfield.
As expected, if a press again "c", because Shortcut KEY_C has been removed, the letter "c" should appear in my textfield but it's not the case.
I make a lot of investigation to understand what's going on and I finally discovered the cause of this bug: the line
otherButton.addClickShortcut(Key.KEY_B);
If you comment it, the shortcut KEY_C will be correctly removed.
Tricky one... :-)
The text was updated successfully, but these errors were encountered: