-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5210 from mozilla/dependabot/npm_and_yarn/react-a…
…ria-3.36.0 Bump react-aria from 3.35.1 to 3.36.0
- Loading branch information
Showing
6 changed files
with
1,009 additions
and
966 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { AriaOverlayProps, useMenu as useAriaMenu } from "react-aria"; | ||
import { AriaMenuItemProps, AriaMenuOptions, MenuAria } from "@react-aria/menu"; | ||
import { MenuTriggerState, TreeProps, TreeState } from "react-stately"; | ||
import { RefObject } from "@react-types/shared"; | ||
import { HTMLAttributes } from "react"; | ||
|
||
// MenuTriggerState focusStrategy from react-stately 3.34.0 is typed as | ||
// FocusStrategy | null | ||
// In react-aria 3.36.0, autoFocus is typed as | ||
// boolean | FocusStrategy | undefined | ||
// So, adjust a null value into undefined for use in react-aria | ||
// Presumably, react-aria will reconcile its typings with react-stately | ||
// at some point, at which point this commit can be reverted again. | ||
export type MenuPopupProps<T> = TreeProps<T> & { | ||
onAction: AriaMenuItemProps["onAction"]; | ||
domProps: HTMLAttributes<HTMLElement>; | ||
onClose?: AriaOverlayProps["onClose"]; | ||
autoFocus?: MenuTriggerState["focusStrategy"] | null; | ||
}; | ||
|
||
export function useMenu<T>( | ||
props: MenuPopupProps<T>, | ||
state: TreeState<T>, | ||
ref: RefObject<HTMLElement | null>, | ||
): MenuAria { | ||
const adjustedProps: AriaMenuOptions<T> = { | ||
...props, | ||
autoFocus: props.autoFocus ?? undefined, | ||
}; | ||
return useAriaMenu(adjustedProps, state, ref); | ||
} |
Oops, something went wrong.