-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Labels
Description
Description of the bug (can be considered as edge case)
confirm-dialog
is moving the focus to the confirmButton
when opens. So in case it set to be opened on keydown
, if you press and hold space for some time (it will start dispatching huge amount of keydown
events), the dialog will be opened and on release (keyup
is dispatched and click
afterwards) the confirmButton
will be clicked, so it will be closed right away.
Minimal reproducible example
<vaadin-button>Open dialog</vaadin-button>
<vaadin-confirm-dialog header="Meeting starting" confirm-text="OK">
Your next meeting starts in 5 minutes
</vaadin-confirm-dialog>
const dialog = document.querySelector('vaadin-confirm-dialog');
const button = document.querySelector('vaadin-button');
button.addEventListener('keydown', function(event) {
if (/^( |SpaceBar)$/.test(event.key)) {
dialog.opened = true;
}
});
- Use the code (modified demo example)
- Focus the
Open dialog
button, i.e. with Tab - Hold Space
- Release once dialog is opened.
Expected behaviour
Dialog remains opened
Actual behavior:
Dialog is auto-closed