Skip to content

Commit 415e639

Browse files
committed
feat(Modal): fix CR comments
1 parent e8e418b commit 415e639

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

packages/core/src/components/ModalNew/Modal/Modal.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { camelCase } from "lodash-es";
1010
import { ModalProvider } from "../context/ModalContext";
1111
import { ModalContextProps } from "../context/ModalContext.types";
1212
import useKeyEvent from "../../../hooks/useKeyEvent";
13+
import { keyCodes } from "../../../constants";
1314

1415
const Modal = forwardRef(
1516
(
@@ -27,8 +28,8 @@ const Modal = forwardRef(
2728
}: ModalProps,
2829
ref: React.ForwardedRef<HTMLDivElement>
2930
) => {
30-
const [titleId, setTitleId] = useState<string>("");
31-
const [descriptionId, setDescriptionId] = useState<string>("");
31+
const [titleId, setTitleId] = useState<string>();
32+
const [descriptionId, setDescriptionId] = useState<string>();
3233

3334
const setTitleIdCallback = useCallback((id: string) => setTitleId(id), []);
3435
const setDescriptionIdCallback = useCallback((id: string) => setDescriptionId(id), []);
@@ -61,7 +62,7 @@ const Modal = forwardRef(
6162
useKeyEvent({
6263
callback: onEscClick,
6364
capture: true,
64-
keys: ["Escape"]
65+
keys: [keyCodes.ESCAPE]
6566
});
6667

6768
if (!show) {
@@ -83,8 +84,8 @@ const Modal = forwardRef(
8384
data-testid={dataTestId || getTestId(ComponentDefaultTestId.MODAL_NEXT, id)}
8485
role="dialog"
8586
aria-modal
86-
aria-labelledby={titleId || undefined}
87-
aria-describedby={descriptionId || undefined}
87+
aria-labelledby={titleId}
88+
aria-describedby={descriptionId}
8889
>
8990
<ModalTopActions
9091
renderAction={renderHeaderAction}

packages/core/src/components/ModalNew/Modal/Modal.types.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface ModalProps extends VibeComponentProps {
1414
size?: ModalSize;
1515
closeButtonTheme?: ModalTopActionsProps["color"];
1616
closeButtonAriaLabel?: ModalTopActionsProps["closeButtonAriaLabel"];
17-
onClose?: (e: ModalCloseEvent) => void;
17+
onClose?: (event: ModalCloseEvent) => void;
1818
renderHeaderAction?: ModalTopActionsProps["renderAction"];
1919
children: React.ReactNode;
2020
}

packages/core/src/components/ModalNew/ModalTopActions/ModalTopActions.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ export interface ModalTopActionsProps {
1919
| ((color?: ModalTopActionsButtonColor) => React.ReactElement<typeof MenuButton | typeof IconButton>);
2020
color?: ModalTopActionsColor;
2121
closeButtonAriaLabel?: string;
22-
onClose?: (e: React.MouseEvent<HTMLButtonElement>) => void;
22+
onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
2323
}

0 commit comments

Comments
 (0)