ensure original element isn't focused when showing modal
This commit is contained in:
parent
4817601967
commit
6423ae02b9
|
@ -53,6 +53,9 @@ messageBox.show = async ({
|
|||
if (focusAccessibility.lastFocusedViaClick && document.activeElement) {
|
||||
document.activeElement.dataset.focusedViaClick = '';
|
||||
}
|
||||
if (document.activeElement === messageBox._originalFocus) {
|
||||
document.body.focus();
|
||||
}
|
||||
|
||||
if (typeof onshow === 'function') {
|
||||
onshow(messageBox.element);
|
||||
|
|
|
@ -260,7 +260,7 @@ function moveFocus(rootElement, step) {
|
|||
const activeIndex = step ? Math.max(step < 0 ? 0 : -1, elements.indexOf(activeEl)) : -1;
|
||||
const num = elements.length;
|
||||
if (!step) step = 1;
|
||||
for (let i = 1; i < num; i++) {
|
||||
for (let i = 1; i <= num; i++) {
|
||||
const el = elements[(activeIndex + i * step + num) % num];
|
||||
if (!el.disabled && el.tabIndex >= 0) {
|
||||
el.focus();
|
||||
|
|
Loading…
Reference in New Issue
Block a user