Skip to content

Commit

Permalink
Rename tabs event handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
stephl3 committed May 23, 2024
1 parent 663263a commit dcd5013
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/tabs/src/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const Tabs = (props: AccessibleTabsProps) => {
[children],
);

const handleChange = useCallback(
const handleClickTab = useCallback(
(e: React.SyntheticEvent<Element, MouseEvent>, index: number) => {
setSelected?.(index);
},
Expand All @@ -96,7 +96,7 @@ const Tabs = (props: AccessibleTabsProps) => {
return [enabledIndexes, enabledIndexes.indexOf(selected!)];
}, [childrenArray, selected]);

const handleArrowKeyPress = useCallback(
const handleKeyDown = useCallback(
(e: KeyboardEvent) => {
if (!(e.metaKey || e.ctrlKey)) {
if (e.key === keyMap.ArrowRight) {
Expand Down Expand Up @@ -129,12 +129,12 @@ const Tabs = (props: AccessibleTabsProps) => {
name,
onKeyDown: (event: KeyboardEvent) => {
onKeyDown?.(event);
handleArrowKeyPress(event);
handleKeyDown(event);
},
onClick: !disabled
? (event: React.MouseEvent, index: number) => {
onClick?.(event);
handleChange(event, index);
handleClickTab(event, index);
}
: undefined,
selectedIndex: selected,
Expand Down

0 comments on commit dcd5013

Please sign in to comment.