Skip to content

DisclosurePanel doesn't show when Disclosure is expanded and disabled #7444

Open
@vicky-comeau

Description

@vicky-comeau

Provide a general summary of the issue here

When creating a basic Disclosure component with react aria components, the DisclosurePanel gets a hidden attribute when defaultExpanded and isDisabled are set on the disclosure. It is not hidden="until-found" it is only hidden.
I have no idea what sets this and I didn't see it in spectrum's V2 storybook: https://reactspectrum.blob.core.windows.net/reactspectrum/6de1ad4d4bab6d6debacf576b8ba325871064e7e/storybook-s2/index.html?path=/docs/accordion--docs

🤔 Expected Behavior?

I'd expect the disclosure panel to be visible if defaultExpanded or isExpanded is set to true and the disclosure is disabled. No hidden attribute should be added.

😯 Current Behavior

A hidden attribute is added to the disclosure panel and it is not visible when disabled and expanded.

💁 Possible Solution

Find why the hidden attribute is added and remove it if the panel is expanded.

🔦 Context

I am creating a Disclosure component for our design system and I was creating some chromatic tests when I noticed this issue. It may not be something that comes up, but the fact that it's possible to do, I think it should behave as expected.

🖥️ Steps to Reproduce

https://codesandbox.io/p/devbox/p26t7n?file=%2Fsrc%2FApp.tsx%3A11%2C8
This was the code:

<Disclosure isDisabled defaultExpanded>
      <Button>test</Button>
      <DisclosurePanel>test</DisclosurePanel>
    </Disclosure>

Version

react-aria-components: 1.5.0

What browsers are you seeing the problem on?

Microsoft Edge

If other, please specify.

No response

What operating system are you using?

Windows 11

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    RACbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions