Skip to content

ECHOES-1337 ECHOES-1338 Align toast lifecycle defaults with notification guidelines#699

Closed
david-cho-lerat-sonarsource wants to merge 1 commit into
mainfrom
david/ECHOES-1337-1338-align-toast-lifecycle-with-guidelines
Closed

ECHOES-1337 ECHOES-1338 Align toast lifecycle defaults with notification guidelines#699
david-cho-lerat-sonarsource wants to merge 1 commit into
mainfrom
david/ECHOES-1337-1338-align-toast-lifecycle-with-guidelines

Conversation

@david-cho-lerat-sonarsource

@david-cho-lerat-sonarsource david-cho-lerat-sonarsource commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary by Gitar

  • Refactored toast durations:
    • Updated Short, Medium, and Long durations to 3s, 5s, and 8s respectively.
    • Set Medium as the default for regular toasts and Long as the default for toasts with actions.
  • Updated configuration:
    • Reduced EchoesProvider default toastsVisibleNb from 5 to 3.
  • Improved type safety and documentation:
    • Removed strict requirement for infinite duration on toasts with actions.
    • Clarified usage guidelines for infinite duration toasts in JSDoc and Toast-stories.
  • Updated testing:
    • Adjusted existing tests to reflect new duration timings.
    • Added new test coverage for default auto-dismiss behavior on regular and action-based toasts.

This will update automatically on new commits.

@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for echoes-react ready!

Name Link
🔨 Latest commit 4f392ba
🔍 Latest deploy log https://app.netlify.com/projects/echoes-react/deploys/6a2ab9245547be00088c34fa
😎 Deploy Preview https://deploy-preview-699--echoes-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jun 11, 2026

Copy link
Copy Markdown

ECHOES-1337
ECHOES-1338

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@david-cho-lerat-sonarsource david-cho-lerat-sonarsource force-pushed the david/ECHOES-1337-1338-align-toast-lifecycle-with-guidelines branch from 8131543 to 4f392ba Compare June 11, 2026 13:33
@sonarqube-next

Copy link
Copy Markdown

@gregaubert gregaubert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code changes are looking fine. But I strongly disagree with the timing changes and the fact that toast with actions don't have the infinite duration anymore.

Comment thread src/utils/toasts.tsx
Comment on lines -38 to +53
* Short duration for toasts with only 1 line of text (8 seconds).
* Short duration (3 seconds) for brief transient toasts when a shorter-than-default lifetime is
* intentional.
*/
Short = 'short',
/**
* Medium duration for toasts with 2 lines of text (16 seconds) - default duration.
* Medium duration (5 seconds). This is the default for regular toasts.
*/
Medium = 'medium',
/**
* Long duration for toasts with 3 lines of text (24 seconds).
* Long duration (8 seconds). This is the default for toasts with actions, or for regular toasts
* that intentionally need a bit more time.
*/
Long = 'long',
/**
* Infinite duration toast that remains visible until manually dismissed.
* Mandatory when the toast has actions.
* Infinite duration for toasts that must remain visible until the user dismisses them, such as
* critical or complex errors.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we really sure about the timing changes there?

  • short - 3 seconds: I barely have the time to notice there is a toast that showed up, so no way I can read it...
  • long - 8 seconds: default for toasts with actions... with actions really? there is no way we can expect someone to click on an action in toast that disappear after 8 seconds... The time to read the text, take a decision, move your mouse to click... 8 seconds there is no way. Toast with actions should be infinite and dismissable no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

before this PR we had 8/16/24 for short/medium/long, but the ZH doc says 3/5/8 here: https://echoes.sonarsource.com/79d336d52/v/0/p/2062ab-notifications/t/fd8002b62b
even for toasts with action. But you're right to push back on that, that's something we should challenge with you @marciopmoreira6 & @2amelia, let's discuss

Comment thread src/utils/toasts.tsx
const durationValue = isDefined(toastProps.actions)
? TOAST_DURATION_MAP[ToastDuration.Infinite]
: TOAST_DURATION_MAP[duration];
const resolvedDuration = duration ?? (hasActions ? ToastDuration.Long : ToastDuration.Medium);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't undersand and agree with this change... I even think having a timer on something that contains an action is against accessibility rules.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let's discuss with @marciopmoreira6 & @2amelia , maybe it's the ZH docs that need changing, not Echoes?

@david-cho-lerat-sonarsource

Copy link
Copy Markdown
Contributor Author

The ZH doc was not up to date

@gitar-bot

gitar-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Aligns toast lifecycle durations and visibility limits with notification guidelines by adjusting default timings and provider settings. All component tests are updated to reflect these new auto-dismiss behaviors.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

3 participants