Closed GuoXiaoyang closed 2 months ago
Thanks for reporting, it looks like
item.props.onAction
&&
props.onAction
We should check if any of the other collections suffer from this. We may just be missing some prioritization on calling them, an else if, instead of just an if.
Provide a general summary of the issue here
After we upgraded our react-aria to 3.33.1, the onAction handler which passed to MenuItem directly was broken. It is called twice but not once only.
I noticed the change was introduced in this pull request: https://github.com/adobe/react-spectrum/pull/5874/files#diff-2237da4ee227fcc1c1be60b57ee78479c8cbac8679abfc5de478689e90e0adaf. And the added test case is passed unexpectedly: https://github.com/adobe/react-spectrum/pull/5874/files#r1658273241
π€ Expected Behavior?
The onAction handler is called only once when passed to MenuItem.
π― Current Behavior
The onAction handler is called twice when passed to MenuItem.
π Possible Solution
No response
π¦ Context
No response
π₯οΈ Steps to Reproduce
https://github.com/adobe/react-spectrum/pull/5874/files#r1658273241
Version
3.33.1
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
macOS 14.5
π§’ Your Company/Team
No response
π· Tracking Issue
No response