-
Notifications
You must be signed in to change notification settings - Fork 16
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
Truncate Toast description #1929
Conversation
JasonMHasperhoven
commented
Nov 27, 2024
- Fixes the case where it may take up the whole screen incase we directly log an error message as description
🦋 Changeset detectedLatest commit: 8d779c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Visit the preview URL for this PR (updated for commit 8d779c7): https://penumbra-ui-preview--pr1929-toast-description-tr-8zq40w0b.web.app (expires Wed, 04 Dec 2024 15:52:18 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 709d729610ef7a6369b23f1cb2b820a60cc685b1 |
description: | ||
typeof options.description === 'string' | ||
? truncateString(options.description, 200) | ||
: options.description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: i don't think this should be a part of the UI component. If users need this, they can truncate the string in their code when passing description
to the Toast. Moreover, UI components should not trim the string programmatically – this worsens the UX. Think of it as a long but important error message – what might happen if users see the start but not the important end of the message?
From the UI components part, we could add "show more"/"show less" buttons if this is really necessary. But still, the description is defined as ReactNode
, so this can be done on the users' side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you're right, but I have no idea where this long error message throwIfAborted comes from.