A11y: add option to disable or always enable a11y features

This commit is contained in:
Pieter Vander Vennet 2024-01-01 03:29:57 +01:00
parent 3059d2ed26
commit 8dd1a0e107
9 changed files with 95 additions and 66 deletions

View file

@ -511,15 +511,25 @@ export class MapLibreAdaptor implements MapProperties, ExportableMap {
await Utils.waitFor(250)
}
}
public installCustomKeyboardHandler(viewport: Store<HTMLDivElement>) {
viewport.mapD(
public installCustomKeyboardHandler(viewportStore: UIEventSource<HTMLDivElement>) {
viewportStore.mapD(
(viewport) => {
const map = this._maplibreMap.data
if (!map) {
return
}
const oldKeyboard = map.keyboard
oldKeyboard._panStep = viewport.getBoundingClientRect().width
const w = viewport.getBoundingClientRect().width
if (w < 10) {
/// this is weird, but definitively wrong!
console.log("Got a very small bound", w, viewport)
// We try again later on
window.requestAnimationFrame(() => {
viewportStore.ping()
})
return
}
oldKeyboard._panStep = w
},
[this._maplibreMap]
)