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

Remove Text from RSP DropZone API #6152

Merged
merged 9 commits into from
Apr 22, 2024
Merged

Remove Text from RSP DropZone API #6152

merged 9 commits into from
Apr 22, 2024

Conversation

yihuiliao
Copy link
Member

@yihuiliao yihuiliao commented Apr 4, 2024

Currently if you want to use RSP DropZone, you also have to import from RAC in order to use the Text component which is needed to create an accessible name for screenreader users. This might be confusing for some users which is why we'd like to get rid it of it and have <Heading> handle that work instead.

With this change, the API should look something like this:

<DropZone>
  <IllustratedMessage>
    <Heading>
    <Content>
  </IllustratedMessage>
</DropZone>

✅ 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:

🧢 Your Project:

@rspbot
Copy link

rspbot commented Apr 4, 2024

@@ -41,13 +42,15 @@ function DropZone(props: SpectrumDropZoneProps, ref: DOMRef<HTMLDivElement>) {
let {styleProps} = useStyleProps(props);
let domRef = useDOMRef(ref);
let messageId = useId();
let headingId = useId();
Copy link
Member Author

Choose a reason for hiding this comment

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

Reid suggested to pass the headingId via slot which I would have liked to do but the problem is that it gets overridden in IllustratedMessage so it doesn't actually get passed all the way through

Copy link
Member

Choose a reason for hiding this comment

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

I wonder why we decided to clear slots in Illustrated Message. Maybe we could test to see what happens when we remove that https://github.com/adobe/react-spectrum/pull/3420/files#diff-75401696e93859335f6081190bc047f0be8ff0b8e70f4639ae0e0944f8a3cf46R48-R52

Copy link
Member Author

@yihuiliao yihuiliao Apr 5, 2024

Choose a reason for hiding this comment

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

Yeah I tired removing it locally which seems to work, though it looks like the reason for adding <ClearSlots was because we were concerned of possible collisions since IllustratedMessage uses the "illustration" slot and so does anything that's wrapped with <Illustration>

#3420 (comment)

@adobe adobe deleted a comment from rspbot Apr 5, 2024
@rspbot
Copy link

rspbot commented Apr 5, 2024

@adobe adobe deleted a comment from rspbot Apr 6, 2024
@rspbot
Copy link

rspbot commented Apr 11, 2024

@adobe adobe deleted a comment from rspbot Apr 11, 2024
let ariaLabel = props['aria-label'] || stringFormatter.format('dropzoneLabel');
let messageId = props['aria-labelledby'];
// Chrome + VO will not announce the drop zone's accessible name if useLabels combines an aria-label and aria-labelledby
Copy link
Member Author

Choose a reason for hiding this comment

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

apparently this doesn't seem to be an issue anymore? seems like chrome + VO is now happy to announce the accessible name if useLabel combines aria-label and aria-labelledby so i've removed the workaround and updated the tests accordingly

Copy link
Member

Choose a reason for hiding this comment

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

we might want to bisect chrome a bit so we don't remove while a recent-ish version still has the issue
can you do that? https://github.com/jay0lee/chrome-bisect

Copy link
Member Author

Choose a reason for hiding this comment

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

okay...tried the chrome bisect and tested back to v111 which was released march 2023 and for whatever reason could not reproduce it. im not sure what's going on cause i swear this was an issue in the past 😭

@yihuiliao yihuiliao changed the title (wip) Remove Text from RSP DropZone API Remove Text from RSP DropZone API Apr 11, 2024
@yihuiliao yihuiliao marked this pull request as ready for review April 11, 2024 22:47
Copy link
Member

@ktabors ktabors left a comment

Choose a reason for hiding this comment

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

Looks good.
I noticed the docs examples still have <Text /> in them.

@rspbot
Copy link

rspbot commented Apr 12, 2024

@rspbot
Copy link

rspbot commented Apr 21, 2024

@rspbot
Copy link

rspbot commented Apr 22, 2024

@rspbot
Copy link

rspbot commented Apr 22, 2024

## API Changes

unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any', access: 'private' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown top level export { type: 'identifier', name: 'Column' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown type { type: 'link' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }
unknown top level export { type: 'any' }

@LFDanLu LFDanLu merged commit 888267c into main Apr 22, 2024
25 checks passed
@LFDanLu LFDanLu deleted the rsp-dropzone-heading branch April 22, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants