-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: useIsOverflowItemVisible returns incorrect at initial state #27656
Comments
Hi @ling1726 Do you have any timeline for this to be fixed? We are planning on our product's release. Thank you! |
@flora8984461 I've added this to the next sprint 01/05 - 14/05 |
Fixes microsoft#27656 which was caused by a priority queue edge case. On initial mount the resize observer will always run. If there is already overflow then the tops of the visibility queues will be different from the initial state (all items are considered visible by default). In the cause where there is no overflow initially the queue tops will not change, which does not trigger a dispatch to the react bindings so the `useIsOverflowItemVisible` hook will always return `false` until overflow occurs. The fix is quite simple: set the initial value of flag `forceDispatch` to be `true` which will always trigger a dispatch for initial mount.
* fix: overflowManager should always dispatch initial state Fixes #27656 which was caused by a priority queue edge case. On initial mount the resize observer will always run. If there is already overflow then the tops of the visibility queues will be different from the initial state (all items are considered visible by default). In the cause where there is no overflow initially the queue tops will not change, which does not trigger a dispatch to the react bindings so the `useIsOverflowItemVisible` hook will always return `false` until overflow occurs. The fix is quite simple: set the initial value of flag `forceDispatch` to be `true` which will always trigger a dispatch for initial mount. * changefile
🎉This issue was addressed in #27756, which has now been successfully released as Handy links: |
🎉This issue was addressed in #27756, which has now been successfully released as Handy links: |
Library
React Components / v9 (@fluentui/react-components)
System Info
Are you reporting Accessibility issue?
None
Reproduction
https://codesandbox.io/s/admiring-feather-mtyojz?file=/example.tsx
Bug Description
Actual Behavior
At initial state when there is enough space for all items to show, useIsOverflowItemVisible returns false for each item. As the screenshot shows, and you can also check it in the reproduction codesandbox. It feels like at initial state, and the space is enough, items are not registered to the overflow or the initial context set to false; and the state in context changes only after resize happens. (Let me know if my guess is correct, thank you 😊)
Expected Behavior
Expect the useIsOverflowItemVisible returns true when initial state the items are really showing.
Logs
No response
Requested priority
High
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
The text was updated successfully, but these errors were encountered: