useCalendar - navigation button props contain an (unknown?) onFocusChange prop #5170
-
In the latest release of "@react-aria/calendar", the returned button props of This produces console errors in reacts dev mode:
This happens for me when spreading Furthermore, I could not find any documentation on a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Small repro where only the navigation buttons are rendered: |
Beta Was this translation helpful? Give feedback.
-
You'll need to spread function Button(props) {
const ref = useRef(null);
const { buttonProps } = useButton(props, ref);
return <button {...buttonProps} ref={ref}>{props.children}</button>;
} https://codesandbox.io/p/sandbox/hungry-mccarthy-pjdm4y This is because |
Beta Was this translation helpful? Give feedback.
You'll need to spread
prevButtonProps
/nextButtonProps
onto a button created withuseButton
. You can update your example to this instead:https://codesandbox.io/p/sandbox/hungry-mccarthy-pjdm4y
This is because
prevButtonProps
/nextButtonProps
contain handlers such asonPress
andonFocusChange
that aren't attributes of native buttons.