Skip to content
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]: FlatTree is not navigable when 0 item is in the tree on initial render #31583

Closed
2 tasks done
YuanboXue-Amber opened this issue Jun 5, 2024 · 0 comments · Fixed by #31595
Closed
2 tasks done

Comments

@YuanboXue-Amber
Copy link
Contributor

Library

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

System Info

9.53.0

Are you reporting Accessibility issue?

yes

Reproduction

https://stackblitz.com/edit/9asbui?file=src%2Fexample.tsx,src%2FApp.tsx

Bug Description

Actual Behavior

The example contains a FlatTree, and on initial render it has empty children.
Tab on the button, press Enter key on the button, and the tree become visible.
Notice that Tabbing again doesn't focus on the tree.
Click on a TreeItem and use arrow up/down doesn't focus on the next item.

Expected Behavior

The navigation should work even if the tree is rendered initially with empty items.

This is discovered when building a virtualized tree. On initial render, 0 items are rendered in the virtualized tree because it needs to measure the size of the container.

Although this can be easily fixed by checking items.length, it would be nice to have this fixed in the tree so this type of problem doesn't happen no matter how user code is.

Logs

No response

Requested priority

High

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants