Skip to content

Commit

Permalink
Don't render arrow button inside another button in selectable-material
Browse files Browse the repository at this point in the history
  • Loading branch information
Adamik10 committed Jan 15, 2024
1 parent 2b3e4fe commit 15d4152
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const SelectableMaterial: FC<SelectableMaterialProps & MaterialProps> = ({
openDetailsModal(item);
}
};
const handleOnKeyUp = (e: React.KeyboardEvent<HTMLDivElement>) => {
const handleOnKeyUp = (
e: React.KeyboardEvent<HTMLDivElement | HTMLButtonElement>
) => {
if (openDetailsModal && (e.key === "Enter" || e.key === "Space")) {
openDetailsModal(item);
}
Expand Down Expand Up @@ -150,17 +152,12 @@ const SelectableMaterial: FC<SelectableMaterialProps & MaterialProps> = ({
</div>
</div>
{openDetailsModal && (
<div
className="list-materials__arrow"
role="button"
onClick={handleOnClick}
onKeyUp={handleOnKeyUp}
tabIndex={0}
>
<div className="list-materials__arrow">
<ArrowButton
arrowLabelledBy={listId(item)}
cursorPointer
clickEventHandler={() => openDetailsModal(item)}
clickEventHandler={handleOnClick}
keyUpEventHandler={handleOnKeyUp}
/>
</div>
)}
Expand Down

0 comments on commit 15d4152

Please sign in to comment.