MDL-70075 core: Do not return a value in an event handler

Returning a value of `false` in an event handler has the effect of
calling event.preventDefault() and event.stopPropagation().

This is neither obvious, nor desirable in this situation.
This commit is contained in:
Andrew Nicols
2020-11-04 11:27:55 +08:00
parent 5d16bfcf7c
commit a88838c25f
3 changed files with 7 additions and 7 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -821,7 +821,8 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
// Find the active one.
var element = selectionsElement.children('[data-active-selection]');
if (!element.length) {
return activateSelection(0, state);
activateSelection(0, state);
return;
}
});
// Keyboard navigation for the selection list.
@@ -835,7 +836,7 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
// Choose the next selection item.
pendingPromise.resolve(activateNextSelection(state));
return false;
return;
case KEYS.LEFT:
case KEYS.UP:
// We handled this event, so prevent it.
@@ -843,7 +844,7 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
// Choose the previous selection item.
pendingPromise.resolve(activatePreviousSelection(state));
return false;
return;
case KEYS.SPACE:
case KEYS.ENTER:
// Get the item that is currently selected.
@@ -854,12 +855,11 @@ function($, log, str, templates, notification, LoadingIcon, Aria) {
// Unselect this item.
pendingPromise.resolve(deselectItem(options, state, selectedItem, originalSelect));
}
return false;
return;
}
// Not handled. Resolve the promise.
pendingPromise.resolve();
return true;
});
// Whenever the input field changes, update the suggestion list.
if (options.showSuggestions) {