MDL-68778 user: Fetch select from selected option

It seems that the HTMLSelectElement behaves slightly different on Linux
vs MacOS.

On Linux with Firefox 47 when selecting an option the
HTMLOptionElement is returned, whereas on MavOS the HTMLSelectElement
that the Option belongs to is returned.

We need to normalise the value here before resetting the currently
selected item.
This commit is contained in:
Andrew Nicols 2020-05-20 08:47:02 +08:00
parent 1afe68f382
commit db5be3a31c
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

View File

@ -59,7 +59,8 @@ export const init = ({
const registerEventListeners = () => {
CustomEvents.define(Selectors.bulkActionSelect, [CustomEvents.events.accessibleChange]);
jQuery(Selectors.bulkActionSelect).on(CustomEvents.events.accessibleChange, e => {
const action = e.target.value;
const bulkActionSelect = e.target.closest('select');
const action = bulkActionSelect.value;
const tableRoot = getTableFromUniqueId(uniqueid);
const checkboxes = tableRoot.querySelectorAll(Selectors.bulkUserSelectedCheckBoxes);
@ -88,8 +89,7 @@ export const init = ({
.then(modal => {
modal.getRoot().on(ModalEvents.hidden, () => {
// Focus on the action select when the dialog is closed.
const bulkActionSelector = root.querySelector(Selectors.bulkActionSelect);
bulkActionSelector.focus();
bulkActionSelect.focus();
});
return modal;
@ -97,10 +97,10 @@ export const init = ({
.catch(Notification.exception);
}
} else if (action !== '' && checkboxes.length) {
e.target.form.submit();
bulkActionSelect.form.submit();
}
resetBulkAction(e.target);
resetBulkAction(bulkActionSelect);
});
root.addEventListener('click', e => {