Skip to content

Commit

Permalink
fix(appbar-accessibility): Disable map interaction
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-azma committed Mar 13, 2024
1 parent 0a87780 commit 96d5903
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -26,6 +27,8 @@ export function Geolocator() {

const { t } = useTranslation();

const { setMapKeyboardPanInteractions } = useMapStoreActions();

// internal state
const [data, setData] = useState<GeoListItem[]>();
const [error, setError] = useState<Error>();
Expand Down Expand Up @@ -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(() => {
Expand Down

0 comments on commit 96d5903

Please sign in to comment.