Prevent default action from being executed when the button is disabled

When "enter" is pressed in the file picker a "click" event is triggered
on the primary action button. However, in some cases, like when the file
picker is in "Choose" mode and the current directory in the file picker
is the root folder, the primary action button is disabled. In those
cases pressing enter should not trigger a click action on the button and
be ignored instead.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2018-08-30 10:25:09 +02:00
parent 4da9a15b32
commit 4508a12188
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@
self.$buttonrow.find($(event.target)).length === 0
) {
var $button = self.$buttonrow.find('button.primary');
if($button) {
if($button && !$button.prop('disabled')) {
$button.trigger('click');
}
} else if(self.$buttonrow) {