throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");
}
- try {
- data.focusTrap.deactivate();
- } catch (e) {
- // Suppress error messages if the focus could not be returned
- // to the source element because it is no longer available or
- // unknown.
- const ignoreMessage =
- "Your focus-trap must have at least one container with at least one tabbable node in it at all times";
- if (e.message !== ignoreMessage) {
- throw e;
- }
- }
+ data.focusTrap.deactivate();
data.dialog.setAttribute("aria-hidden", "true");
if (data === undefined) {
throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");
}
- try {
- data.focusTrap.deactivate();
- }
- catch (e) {
- // Suppress error messages if the focus could not be returned
- // to the source element because it is no longer available or
- // unknown.
- const ignoreMessage = "Your focus-trap must have at least one container with at least one tabbable node in it at all times";
- if (e.message !== ignoreMessage) {
- throw e;
- }
- }
+ data.focusTrap.deactivate();
data.dialog.setAttribute("aria-hidden", "true");
// Move the keyboard focus away from a now hidden element.
const activeElement = document.activeElement;