Skip to content

Select / ComboBox Open State isn't Persisted into Button's isPressed Render Prop #7009

Closed
@ArrayKnight

Description

@ArrayKnight

Provide a general summary of the issue here

A bit of an undocumented feature that doesn't seem to work completely as intended. Select and ComboBox both keep the button in the pressed state if the popover is in an open state:

https://github.com/adobe/react-spectrum/blob/main/packages/react-aria-components/src/Select.tsx#L170

https://github.com/adobe/react-spectrum/blob/main/packages/react-aria-components/src/ComboBox.tsx#L185

In the render props, this doesn't work and the isOpen render prop from the Select / ComboBox must be used

However, the data attributes on the Button do reflect the persisted pressed state. This inconsistency in state representation is undesirable

🤔 Expected Behavior?

It would be nice to isolate render functions as much as possible and not have them wrapped around so much of the children components. So, it would be desirable to be able to use the isPressed render prop from the Button to change icons based on state

😯 Current Behavior

IsPressed render prop from Button corresponds to user interaction and is not overridden by state provided by Select/Combobox as seems to be intended

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/musing-maxwell-y3p2hy?workspaceId=9ca74201-e2f5-4f45-ad8e-200e6382b9bd

Version

RAC @ 1.3.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

Mac & Windows

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions