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'),
|
||||
focuser: $('focuser'),
|
||||
// focuser: $('focuser'),
|
||||
|
||||
container: container,
|
||||
rotate: $('lt-rotate'),
|
||||
|
|
@ -1834,9 +1834,6 @@
|
|||
// update everything dependent on the platform size
|
||||
platform.update_size();
|
||||
|
||||
// ensure hot keys work even in iframes
|
||||
API.focus();
|
||||
|
||||
// restore expert setting preference
|
||||
API.mode.set_expert(control.expert);
|
||||
|
||||
|
|
@ -1882,6 +1879,14 @@
|
|||
$('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
|
||||
$('gotit').onclick = () => {
|
||||
$('gdpr').style.display = 'none';
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@
|
|||
js2o: js2o,
|
||||
ajax: ajax,
|
||||
clone: clone,
|
||||
focus: setFocus,
|
||||
focus: () => {},
|
||||
stats: STATS,
|
||||
catalog: CATALOG,
|
||||
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) {
|
||||
let oldMode = viewMode;
|
||||
viewMode = mode;
|
||||
|
|
|
|||
|
|
@ -979,13 +979,6 @@ and (orientation : landscape) {
|
|||
align-items: stretch;
|
||||
}
|
||||
|
||||
#focuser {
|
||||
position: fixed;
|
||||
z-index: -100;
|
||||
left: -100%;
|
||||
top: -100%;
|
||||
}
|
||||
|
||||
#gdpr {
|
||||
position: absolute;
|
||||
display: none;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
<script src="/code/kiri.js?{{version}}"></script>
|
||||
</head>
|
||||
<body class="col">
|
||||
<input id="focuser" size=10></input>
|
||||
<div id="curtain" class="j-center a-center">loading...</div>
|
||||
<div id="container"></div>
|
||||
<div id="tracker"></div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue