Skip to content

[Bug]: useIsOverflowItemVisible returns incorrect at initial state #27656

@flora8984461

Description

@flora8984461

Library

React Components / v9 (@fluentui/react-components)

System Info

System:
    OS: Windows 10 10.0.22621
    CPU: (12) x64 Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz
    Memory: 51.85 GB / 63.57 GB
  Browsers:
    Edge: Spartan (44.22621.1105.0), Chromium (109.0.1518.78)
    Internet Explorer: 11.0.22621.1

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 😊)

image

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

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions