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

feat: Allow ReactNode as children/content of the Toast - closes #6038 #6114

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Rados51
Copy link

@Rados51 Rados51 commented Mar 27, 2024

Closes #6038

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

yarn jest

@Rados51 Rados51 closed this Mar 27, 2024
@Rados51 Rados51 reopened this Mar 27, 2024
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.

Thanks for the PR!

Question to the team. Do we actually want to allow ReactNode? or should we only allow strings and then parse the strings for b/i/etc and render that ourselves?
Previous concerns were that we didn't want to allow other interactive elements inside a toast. Nor things like images/spinners/etc.

@Rados51
Copy link
Author

Rados51 commented Mar 29, 2024

@snowystinger

If the team decides for text parse, is it okay to use additional property in options (like allowHtmlParse) to skip unnecessary RegEx checks for better perf?

@snowystinger
Copy link
Member

I was thinking very simple. IE, only allow bold.
I'm not too worried about perf, it's a short string for an element that doesn't appear frequently and shouldn't rerender much.

@Rados51
Copy link
Author

Rados51 commented Mar 29, 2024

I guess that would be good to include also a span tag for the possibility of adding class to specific parts of the text. Might not be up to Adobe internal guidelines, but useful for third-party.

@snowystinger
Copy link
Member

We should be talking about this later this week.

However, you brought up an important point. Which is that this is useful for non-spectrum users. We intend to make a RAC toast implementation which should alleviate this particular use case.

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.

Add support for string formatting in React Spectrum v3 toast
3 participants