Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/alertify.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,9 @@
elCover.className = "alertify-cover alertify-cover-hidden";
// set focus to the last element or body
// after the dialog is closed
elCallee.focus();
if (elCallee) {
elCallee.focus();

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on a fallback to reset the tabbing focus at the top of the page instead of the bottom?

if (elCallee) {
    elCallee.focus();
} else {
    document.body.focus();
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have thought about that option, but what i found is that the browser will show the focus border around the body and it does seem kinda strange/annoying since the user didn't trigger the alertrify from the body (i know that you can hide this w/ css, but it seems unnecessary). is it necessary to always reset the focus back to some element after the dialog is closed?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary to always reset the focus back to some element after the dialog is closed?

Nope. I was just curious!

If you could just squash your commits, I'll merge. Thanks

}
}
},

Expand Down