throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");
}
- data.focusTrap.deactivate();
+ try {
+ data.focusTrap.deactivate();
+ } catch (e) {
+ // The focus trap is unable to return the focus if
+ // the origin is no longer focusable. This can happen
+ // when the source is removed or is not longer visible,
+ // the latter typically caused by collapsing menus
+ // on mobile devices.
+ const ignoreErrorMessage =
+ "Your focus-trap must have at least one container with at least one tabbable node in it at all times";
+ if (e.message !== ignoreErrorMessage) {
+ throw e;
+ }
+ }
data.dialog.setAttribute("aria-hidden", "true");
return false;
},
+ setReturnFocus: quickOptions,
});
_focusTrap.activate();
}
if (data === undefined) {
throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");
}
- data.focusTrap.deactivate();
+ try {
+ data.focusTrap.deactivate();
+ }
+ catch (e) {
+ // The focus trap is unable to return the focus if
+ // the origin is no longer focusable. This can happen
+ // when the source is removed or is not longer visible,
+ // the latter typically caused by collapsing menus
+ // on mobile devices.
+ const ignoreErrorMessage = "Your focus-trap must have at least one container with at least one tabbable node in it at all times";
+ if (e.message !== ignoreErrorMessage) {
+ throw e;
+ }
+ }
data.dialog.setAttribute("aria-hidden", "true");
// Move the keyboard focus away from a now hidden element.
const activeElement = document.activeElement;
toggleMobileNavigation(message, quickOptions, navigation);
return false;
},
+ setReturnFocus: quickOptions,
});
_focusTrap.activate();
}