more reliable focus management based on https://supernapie.com/blog/keyboard-focus-in-an-iframe/
This commit is contained in:
parent
9e3f937404
commit
844cbc22a0
4 changed files with 10 additions and 24 deletions
|
|
@ -1142,7 +1142,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
load: $('load-file'),
|
load: $('load-file'),
|
||||||
focuser: $('focuser'),
|
// focuser: $('focuser'),
|
||||||
|
|
||||||
container: container,
|
container: container,
|
||||||
rotate: $('lt-rotate'),
|
rotate: $('lt-rotate'),
|
||||||
|
|
@ -1834,9 +1834,6 @@
|
||||||
// update everything dependent on the platform size
|
// update everything dependent on the platform size
|
||||||
platform.update_size();
|
platform.update_size();
|
||||||
|
|
||||||
// ensure hot keys work even in iframes
|
|
||||||
API.focus();
|
|
||||||
|
|
||||||
// restore expert setting preference
|
// restore expert setting preference
|
||||||
API.mode.set_expert(control.expert);
|
API.mode.set_expert(control.expert);
|
||||||
|
|
||||||
|
|
@ -1882,6 +1879,14 @@
|
||||||
$('gdpr').style.display = 'flex';
|
$('gdpr').style.display = 'flex';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add keyboard focus handler (must use for iframes)
|
||||||
|
WIN.addEventListener('load', function () {
|
||||||
|
WIN.focus();
|
||||||
|
DOC.body.addEventListener('click', function() {
|
||||||
|
WIN.focus();
|
||||||
|
},false);
|
||||||
|
});
|
||||||
|
|
||||||
// dismiss gdpr alert
|
// dismiss gdpr alert
|
||||||
$('gotit').onclick = () => {
|
$('gotit').onclick = () => {
|
||||||
$('gdpr').style.display = 'none';
|
$('gdpr').style.display = 'none';
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,7 @@
|
||||||
js2o: js2o,
|
js2o: js2o,
|
||||||
ajax: ajax,
|
ajax: ajax,
|
||||||
clone: clone,
|
clone: clone,
|
||||||
focus: setFocus,
|
focus: () => {},
|
||||||
stats: STATS,
|
stats: STATS,
|
||||||
catalog: CATALOG,
|
catalog: CATALOG,
|
||||||
conf: {
|
conf: {
|
||||||
|
|
@ -1889,17 +1889,6 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function setFocus(el) {
|
|
||||||
el = [ el || UI.focuser, UI.load, UI.sizeX, DOC.body ];
|
|
||||||
for (let es, i=0; i<el.length; i++) {
|
|
||||||
es = el[i];
|
|
||||||
es.focus();
|
|
||||||
if (DOC.activeElement === es) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setViewMode(mode) {
|
function setViewMode(mode) {
|
||||||
let oldMode = viewMode;
|
let oldMode = viewMode;
|
||||||
viewMode = mode;
|
viewMode = mode;
|
||||||
|
|
|
||||||
|
|
@ -979,13 +979,6 @@ and (orientation : landscape) {
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
}
|
}
|
||||||
|
|
||||||
#focuser {
|
|
||||||
position: fixed;
|
|
||||||
z-index: -100;
|
|
||||||
left: -100%;
|
|
||||||
top: -100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#gdpr {
|
#gdpr {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
<script src="/code/kiri.js?{{version}}"></script>
|
<script src="/code/kiri.js?{{version}}"></script>
|
||||||
</head>
|
</head>
|
||||||
<body class="col">
|
<body class="col">
|
||||||
<input id="focuser" size=10></input>
|
|
||||||
<div id="curtain" class="j-center a-center">loading...</div>
|
<div id="curtain" class="j-center a-center">loading...</div>
|
||||||
<div id="container"></div>
|
<div id="container"></div>
|
||||||
<div id="tracker"></div>
|
<div id="tracker"></div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue