From 96d5903044d6faeac99f2eb72f774b79cb1154c5 Mon Sep 17 00:00:00 2001 From: "amir.azma" Date: Mon, 11 Mar 2024 20:56:54 -0400 Subject: [PATCH] fix(appbar-accessibility): Disable map interaction --- .../src/core/components/geolocator/geolocator.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/geoview-core/src/core/components/geolocator/geolocator.tsx b/packages/geoview-core/src/core/components/geolocator/geolocator.tsx index f7f3b53d0b6..16f802c3694 100644 --- a/packages/geoview-core/src/core/components/geolocator/geolocator.tsx +++ b/packages/geoview-core/src/core/components/geolocator/geolocator.tsx @@ -4,11 +4,12 @@ import debounce from 'lodash/debounce'; import { CloseIcon, SearchIcon, AppBar, Box, Divider, IconButton, ProgressBar, Toolbar } from '@/ui'; import { FocusTrapElement } from '@/core/components/common/focus-trap-element'; import { StyledInputField, sxClasses } from './geolocator-style'; -import { OL_ZOOM_DURATION, ARROW_KEY_CODES } from '@/core/utils/constant'; +import { OL_ZOOM_DURATION } from '@/core/utils/constant'; import { useUIAppbarGeolocatorActive, useUIStoreActions } from '@/core/stores/store-interface-and-intial-values/ui-state'; import { useAppGeolocatorServiceURL, useAppDisplayLanguage } from '@/core/stores/store-interface-and-intial-values/app-state'; import { GeolocatorResult } from './geolocator-result'; import { logger } from '@/core/utils/logger'; +import { useMapStoreActions } from '@/core/stores/store-interface-and-intial-values/map-state'; export interface GeoListItem { key: string; @@ -26,6 +27,8 @@ export function Geolocator() { const { t } = useTranslation(); + const { setMapKeyboardPanInteractions } = useMapStoreActions(); + // internal state const [data, setData] = useState(); const [error, setError] = useState(); @@ -150,15 +153,12 @@ export function Geolocator() { }; const handleKeyDown = (event: KeyboardEvent) => { + // disables map interactions (arrow keys won't move the map) + setMapKeyboardPanInteractions(0); + if (event.key === 'Escape') { setGeolocatorActive(false); } - - if (ARROW_KEY_CODES.includes(event.code as string)) { - // TODO stop moving the map here - event.preventDefault(); - event.stopPropagation(); - } }; useEffect(() => {