Skip to content

RAC Tree: Expanding a tree item requires two clicks if expandedKeys/onExpandedChange is used (selectionMode=none) #8263

Open
@dawi

Description

@dawi

Provide a general summary of the issue here

By default, clicking a TreeItem toggles its expansion state. However, when controlling the expansion manually using expandedKeys and onExpandedChange, the behavior changes.

After a page reload, it takes two clicks to toggle the expansion state of a TreeItem. After this initial interaction, everything works as expected.

What's particularly strange is that I don’t need to click the same TreeItem twice. I can click anywhere on the page first, then click the TreeItem, and it will toggle as expected.

I have prepared a minimal reproducible example:

🤔 Expected Behavior?

  • A single click should toggle the expanded state, even after a reload.
  • The behavior with controlled expansion state via expandedKeys and onExpandedChange should not be different from the uncontrolled version.

😯 Current Behavior

After a page reload, it takes two clicks to toggle the expansion state of a TreeItem. After this initial interaction, everything works as expected.

What's particularly strange is that I don’t need to click the same TreeItem twice. I can click anywhere on the page first, then click the TreeItem, and it will toggle as expected.

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

I have prepared a minimal reproducible example:

Version

react-aria-components 1.8.0

What browsers are you seeing the problem on?

Chrome, Firefox

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions