Skip to content

Commit

Permalink
fix(Dropdown): allow KeyboardEvent in toggle's originalEvent type
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Jul 19, 2021
1 parent 1fafb35 commit 56cd1f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,11 @@ export interface DropdownInjectedProps {
onKeyDown: React.KeyboardEventHandler;
}

export type ToggleEvent = React.SyntheticEvent | KeyboardEvent | MouseEvent;

export interface ToggleMetadata {
source: string | undefined;
originalEvent: React.SyntheticEvent | Event | undefined;
originalEvent: ToggleEvent | undefined;
}

export interface DropdownProps {
Expand Down Expand Up @@ -173,8 +175,8 @@ function Dropdown({
const toggle = useCallback(
(
nextShow: boolean,
event?: Event | React.SyntheticEvent,
source = event?.type,
event: ToggleEvent | undefined,
source: string | undefined = event?.type,
) => {
onToggle(nextShow, { originalEvent: event, source });
},
Expand Down

0 comments on commit 56cd1f4

Please sign in to comment.