mirror of https://github.com/mastodon/mastodon
fix: support KaiOS arrow navigation on public pages (#12251)
This commit is contained in:
parent
e37358b3bc
commit
1e232e455c
|
@ -0,0 +1,16 @@
|
||||||
|
// 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();
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ import escapeTextContentForBrowser from 'escape-html';
|
||||||
import loadPolyfills from '../mastodon/load_polyfills';
|
import loadPolyfills from '../mastodon/load_polyfills';
|
||||||
import ready from '../mastodon/ready';
|
import ready from '../mastodon/ready';
|
||||||
import { start } from '../mastodon/common';
|
import { start } from '../mastodon/common';
|
||||||
|
import loadKeyboardExtensions from '../mastodon/load_keyboard_extensions';
|
||||||
|
|
||||||
start();
|
start();
|
||||||
|
|
||||||
|
@ -259,6 +260,9 @@ function main() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
loadPolyfills().then(main).catch(error => {
|
loadPolyfills()
|
||||||
console.error(error);
|
.then(main)
|
||||||
});
|
.then(loadKeyboardExtensions)
|
||||||
|
.catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
"@babel/runtime": "^7.5.4",
|
"@babel/runtime": "^7.5.4",
|
||||||
"@clusterws/cws": "^0.15.2",
|
"@clusterws/cws": "^0.15.2",
|
||||||
"array-includes": "^3.0.3",
|
"array-includes": "^3.0.3",
|
||||||
|
"arrow-key-navigation": "^1.0.2",
|
||||||
"autoprefixer": "^9.6.1",
|
"autoprefixer": "^9.6.1",
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
|
|
|
@ -1657,6 +1657,11 @@ arrify@^1.0.1:
|
||||||
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
|
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
|
||||||
integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=
|
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:
|
asap@~2.0.3:
|
||||||
version "2.0.6"
|
version "2.0.6"
|
||||||
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
|
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46"
|
||||||
|
|
Loading…
Reference in New Issue