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

fix: Support hidden="until-found" in DisclosureGroup #7199

Merged
merged 13 commits into from
Oct 21, 2024

Conversation

reidbarber
Copy link
Member

@reidbarber reidbarber commented Oct 15, 2024

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Test Ctrl+F behavior for all S2 Accordion and Disclosure stories.

🧢 Your Project:

@rspbot
Copy link

rspbot commented Oct 16, 2024

@snowystinger
Copy link
Member

Controlled doesn't seem to quite work right? https://reactspectrum.blob.core.windows.net/reactspectrum/f0457c575ce0bc023f31532191d0d5e809ccc052/storybook-s2/index.html?path=/story/accordion--controlled-open
Do we just need to add the rest of the controlled logic to this one? otherwise I get into this state and can't close the first one.
Screenshot 2024-10-17 at 7 36 24 am

@reidbarber reidbarber changed the title WIP: Support hidden="until-found" in DisclosureGroup Support hidden="until-found" in DisclosureGroup Oct 18, 2024
@reidbarber reidbarber changed the title Support hidden="until-found" in DisclosureGroup fix: Support hidden="until-found" in DisclosureGroup Oct 18, 2024
@rspbot
Copy link

rspbot commented Oct 18, 2024

@rspbot
Copy link

rspbot commented Oct 18, 2024

@rspbot
Copy link

rspbot commented Oct 18, 2024

## API Changes

@react-aria/disclosure

/@react-aria/disclosure:useDisclosure

 useDisclosure {
   props: AriaDisclosureProps
   state: DisclosureState
-  ref?: RefObject<Element | null>
+  ref: RefObject<Element | null>
   returnVal: undefined
 }

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in Chrome, appears to be working as expected.

  • Uncontrolled, opens when text is found
  • Uncontrolled allows multiple expanded, all of them open sequentially as expected and stay open
  • Disabled disclosures do not open even if text is in them
  • Controlled, opens when text is found, key is updated. Can open other panel and redo my actions
  • Controlled works with allows multiple expanded
  • Controlled always open does not appear to ever open the accordion with the text we're looking for

Any other cases I should be trying?

I did notice that some of the Accordion s2 stories have disclosures without id's, not part of this PR, but I thought those were required?

@@ -172,8 +172,9 @@ describe('useDisclosure', () => {
});

expect(result.current.state.isExpanded).toBe(false);
expect(ref.current.getAttribute('hidden')).toBeNull();
expect(onExpandedChange).not.toHaveBeenCalled();
expect(ref.current.getAttribute('hidden')).toBe('until-found');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I listed a lot of test cases in my review, can we add them either here or in followup?

@reidbarber reidbarber added this pull request to the merge queue Oct 21, 2024
Merged via the queue into main with commit b887497 Oct 21, 2024
30 checks passed
@reidbarber reidbarber deleted the disclosuregroup-hidden-until-found branch October 21, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants