phanpy/src/utils/open-osk.js
Lim Chee Aun 80d4a45a65 s/jsx/js extension
Somehow vscode refactor "Move to a new file" preserves the jsx extension
2024-09-23 12:43:55 +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);
}
}