phanpy/src/utils/open-osk.jsx
Lim Chee Aun d2af509eaf Hacky way to show on-screen keyboard
Doesn't work some of the time.
2024-03-27 21:22:47 +08:00

16 lines
495 B
JavaScript

const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); // https://stackoverflow.com/a/23522755
export default function openOSK() {
if (isSafari) {
const fauxEl = document.createElement('input');
fauxEl.style.position = 'absolute';
fauxEl.style.top = '0';
fauxEl.style.left = '0';
fauxEl.style.opacity = '0';
document.body.appendChild(fauxEl);
fauxEl.focus();
setTimeout(() => {
document.body.removeChild(fauxEl);
}, 500);
}
}