Skip to content

Commit

Permalink
fix(appbar-accessibility): Minor change to address PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-azma committed Mar 13, 2024
1 parent 70e4759 commit 0a87780
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/require-default-props */
import { ReactNode, useEffect } from 'react';

import { useTranslation } from 'react-i18next';
Expand All @@ -22,7 +21,8 @@ type FocusTrapElementProps = {
* @returns {JSX.Element} the geolocator button
*/
export function FocusTrapElement(props: FocusTrapElementProps): JSX.Element {
const { id, content, basic = false, active = false } = props;
// We can set basic to be true if we don't have to have Exit button and enabling "open" props in focus trap is based on "active" props
const { id, content, basic, active } = props;

const { t } = useTranslation<string>();

Expand Down Expand Up @@ -57,7 +57,7 @@ export function FocusTrapElement(props: FocusTrapElementProps): JSX.Element {
// #endregion

return (
<FocusTrap open={basic ? active : id === focusItem.activeElementId}>
<FocusTrap open={basic ? (active as boolean) : id === focusItem.activeElementId}>
{!basic ? (
<Box>
<Button
Expand All @@ -77,3 +77,8 @@ export function FocusTrapElement(props: FocusTrapElementProps): JSX.Element {
</FocusTrap>
);
}

FocusTrapElement.defaultProps = {
basic: false,
active: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ export function Geolocator() {
setGeolocatorActive(false);
}

if (ARROW_KEY_CODES.includes(event.code)) {
if (ARROW_KEY_CODES.includes(event.code as string)) {
// TODO stop moving the map here
event.preventDefault();
event.stopPropagation();
}
};

Expand Down

0 comments on commit 0a87780

Please sign in to comment.