Prevent pressing enter key without control focus from activating the primary button

Signed-off-by: Christopher Ng <chrng8@gmail.com>
This commit is contained in:
Christopher Ng 2022-05-27 19:21:05 +00:00
parent fc56c0eb91
commit 83e16b89a2
3 changed files with 3 additions and 15 deletions

View file

@ -92,18 +92,6 @@ $.widget('oc.ocdialog', {
event.preventDefault()
return false
}
// If no button is selected we trigger the primary
if (
self.$buttonrow
&& self.$buttonrow.find($(event.target)).length === 0
) {
const $button = self.$buttonrow.find('button.primary')
if ($button && !$button.prop('disabled')) {
$button.trigger('click')
}
} else if (self.$buttonrow) {
$(event.target).trigger('click')
}
return false
}
})

4
dist/core-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long