--- /dev/null
+// On KaiOS, we may not be able to use a mouse cursor or navigate using Tab-based focus, so we install
+// special left/right focus navigation keyboard listeners, at least on public pages (i.e. so folks
+// can at least log in using KaiOS devices).
+
+function importArrowKeyNavigation() {
+ return import(/* webpackChunkName: "arrow-key-navigation" */ 'arrow-key-navigation');
+}
+
+export default function loadKeyboardExtensions() {
+ if (/KAIOS/.test(navigator.userAgent)) {
+ return importArrowKeyNavigation().then(arrowKeyNav => {
+ arrowKeyNav.register();
+ });
+ }
+ return Promise.resolve();
+}
import loadPolyfills from '../mastodon/load_polyfills';
import ready from '../mastodon/ready';
import { start } from '../mastodon/common';
+import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions';
start();
});
}
-loadPolyfills().then(main).catch(error => {
- console.error(error);
-});
+loadPolyfills()
+ .then(main)
+ .then(loadKeyboardExtensions)
+ .catch(error => {
+ console.error(error);
+ });
"@babel/runtime": "^7.5.4",
"@clusterws/cws": "^0.15.2",
"array-includes": "^3.0.3",
+ "arrow-key-navigation": "^1.0.2",
"autoprefixer": "^9.6.1",
"axios": "^0.19.0",
"babel-loader": "^8.0.6",
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=
+arrow-key-navigation@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/arrow-key-navigation/-/arrow-key-navigation-1.0.2.tgz#c1b5886240819db6c0b2b84702de1313786ce53e"
+ integrity sha512-Wj67sJpfK7vrj0/aOstIsRMsUQtpVODBTQDcRaDvvPZdzZMotj8oYGsEsoYiDohShDlDU6ywVkHLtXGH4TfEtQ==
+
asap@~2.0.3:
version "2.0.6"
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"