MessageBox: Add focus to OK button
This commit is contained in:
parent
f2efff64fd
commit
1fd0c26e1d
|
@ -123,7 +123,7 @@ function messageBox({
|
||||||
|
|
||||||
function moveFocus(dir) {
|
function moveFocus(dir) {
|
||||||
const elements = [...messageBox.element.getElementsByTagName('*')];
|
const elements = [...messageBox.element.getElementsByTagName('*')];
|
||||||
const activeIndex = elements.indexOf(document.activeElement);
|
const activeIndex = Math.max(0, elements.indexOf(document.activeElement));
|
||||||
const num = elements.length;
|
const num = elements.length;
|
||||||
for (let i = 1; i < num; i++) {
|
for (let i = 1; i < num; i++) {
|
||||||
const elementIndex = (activeIndex + i * dir + num) % num;
|
const elementIndex = (activeIndex + i * dir + num) % num;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user