suppress focus outline when invoked via mouse

fixes #495
This commit is contained in:
tophf 2018-09-06 19:05:10 +03:00
parent dcdb4be10b
commit c57fef7b1e
2 changed files with 6 additions and 0 deletions

View File

@ -329,6 +329,7 @@ function focusAccessibility() {
if (focusables.includes(el.localName)) {
if (el.dataset.focusedViaClick === undefined) {
el.dataset.focusedViaClick = '';
focusAccessibility.lastFocusedViaClick = true;
}
return;
}
@ -337,6 +338,7 @@ function focusAccessibility() {
function keepOutlineOnTab(event) {
if (event.which === 9) {
focusAccessibility.lastFocusedViaClick = false;
setTimeout(keepOutlineOnTab, 0, true);
return;
} else if (event !== true) {

View File

@ -36,6 +36,10 @@ function messageBox({
messageBox.originalFocus = document.activeElement;
moveFocus(messageBox.element, 1);
if (focusAccessibility.lastFocusedViaClick && document.activeElement) {
document.activeElement.dataset.focusedViaClick = '';
}
if (typeof onshow === 'function') {
onshow(messageBox.element);
}