react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

[Docs]: Add missing constants in React Aria > Examples > Contact List

Open sookmax opened this issue 2 years ago • 2 comments

Hello, this PR is not related to any existing issue, but I was trying to use the example code presented here: Contact List and noticed that the variables favorites and people are hidden in the code snippet.

This PR is to reveal those hidden variables in the code snippet explicitly, as to avoid user confusion.

Screenshot (before)

Screenshot 2023-10-25 at 10 13 32 PM

Screenshot (after)

Screenshot 2023-10-25 at 10 21 25 PM

✅ 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).
  • [x] 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:

  1. git clone <this PR>
  2. yarn start:docs
  3. Go to http://localhost:1234/react-aria/examples/contact-list.html and check the code snippet.

🧢 Your Project:

sookmax avatar Oct 25 '23 13:10 sookmax

IMO we need to hide them to keep the example code to a reasonable length. Maybe we can put in a collapsed section but I didn't think anyone would really want our fake content...

devongovett avatar Oct 25 '23 15:10 devongovett

@devongovett I get that revealing the data can be very distracting especially when placed at the top. But at the same time, wouldn't users expect the example code to just work when copied and pasted? (I know I would 😅).

Anyways, I like the idea of making them collapsible.

These look quite nice to me:

Screenshot 2023-10-26 at 8 41 44 PM --- Screenshot 2023-10-26 at 8 42 55 PM

sookmax avatar Oct 26 '23 11:10 sookmax

Gonna close this one for now. In our upcoming docs update we will have the ability to create collapsed code sections like that more easily. We will revisit then.

devongovett avatar Apr 11 '25 19:04 devongovett