fix(developer): don't use osk-always-visible on touch devices

Fixes #9845.

It seems that the logic for `osk-always-visible` is not quite right on
touch devices -- the OSK disappears on blur but remains touchable -- so
presses in the OSK region emit key events. For Keyman Developer Server,
the simple workaround is to only use `<body class="osk-always-visible">`
when on desktop devices.

We should review the logic for `osk-always-visible` in KeymanWeb, so
that this issue does not arise on touch devices. This patch addresses
the issue in Keyman Developer Server, and matches the behaviour we want
on touch devices in any case, as we don't really want the OSK visible
when blurred, unlike on desktop.
This commit is contained in:
Marc Durdin 2023-11-01 05:57:13 +07:00
parent e5ef4e9ee6
commit 4ce16a08fc
2 changed files with 5 additions and 1 deletions

View file

@ -21,7 +21,7 @@
<link href="inc/keyboards.css" type="text/css" rel="stylesheet" /> <!-- This script loads the dynamic keyboard fonts -->
</head>
<body class='osk-always-visible'>
<body>
<header class='navbar navbar-dark bg-dark text-white'>
<div class='container-fluid'>

View file

@ -42,6 +42,10 @@ function enableControls(enable) {
let keymanInitialized = false;
enableControls(false);
if(!keyman.util.isTouchDevice()) {
document.body.className = 'osk-always-visible';
}
keyman.init({
ui:'button',
resources:'/resource/',