Skip to content

fix(ui): scale default toast duration with message length - #7004

Open
Avad05 wants to merge 3 commits into
odysseus-dev:devfrom
Avad05:fix/toast-duration
Open

Avad05 wants to merge 3 commits into
odysseus-dev:devfrom
Avad05:fix/toast-duration

Conversation

@Avad05

@Avad05 Avad05 commented Oct 31, 2026

Copy link
Copy Markdown

Summary

showToast defaults to a fixed 1200 ms, which is too short to read anything longer than a few words. This scales the default with message length at 50 ms per character, clamped between 2 and 6 seconds. Toasts that pass options without a duration keep their 5-second minimum and extend up to 6 seconds for long messages. Explicit durations are unchanged, and the existing 2.5-second cap while the photo editor is open still applies.

This restores #4043, which was approved on Jul 11 but closed unmerged on Jul 23 when dev was force-pushed. Its diff can no longer be reviewed against the rewritten base. One small difference from #4043: the length check uses String(msg || ''), so a non-string message can't break it.

Target branch

  • This PR targets the correct integration branch: lab in the private maintainer-preview repository, or dev in the public repository. main remains release-curated.

Linked Issue

Fixes #4045

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)
  • New feature (non-breaking — adds new behaviour)
  • Breaking change (changes or removes existing behaviour)
  • Refactor / cleanup (behaviour unchanged)
  • Documentation only
  • CI / tooling / configuration

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • This PR targets the correct integration branch (lab in maintainer-preview; dev in the public repository)
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app (docker compose up or uvicorn app:app) and verified the change works end-to-end. Type-checks and unit tests are not enough.
  • I did not run the app/runtime validation and stated that gap in How to Test. Leave this unchecked when the app-run box above is checked.

How to Test

  1. Run the app and trigger a short toast, such as a copy action. It should stay visible for about 2 seconds.
  2. Trigger a long toast of 100+ characters. It should stay for about 5–6 seconds.
  3. Trigger a toast with an explicit duration, and one with the photo editor open. Both should behave as before: the explicit duration is respected, and the editor caps at 2.5 seconds.

Static checks: node --check static/js/ui.js passes and git diff --check is clean.

Visual / UI changes — REQUIRED if you touched anything that renders

This changes how long toasts stay on screen, not how they look. No CSS, colours, layout or markup changed.

  • Screenshot or short clip of the change in the running app, attached below. Mobile screenshot too if the change affects mobile.
  • Style match: the change uses Odysseus's existing visual language. No visual styling changed.
  • No new component patterns. Extends the existing showToast.
  • I am not an LLM agent submitting a bulk PR. If you are, please open an issue describing the problem first — bulk auto-generated PRs that don't match the project's visual style are closed on sight, even when the underlying fix is correct.

Screenshots / clips

606990771-a8b80083-ee94-486c-9a82-e4f37ebe0a5c.mp4

@github-actions github-actions Bot added the ready for review Description complete — ready for maintainer review label Oct 31, 2026
@Avad05

Avad05 commented Nov 30, 2026

Copy link
Copy Markdown
Author

The CI runs on this PR expired before anyone approved them (they need maintainer approval because the PR comes from a fork). I've pushed an empty commit to queue them again. Could a maintainer approve the workflow runs? Thanks!

@github-actions github-actions Bot added merge conflict Conflicts with the base branch; needs a rebase before review. and removed ready for review Description complete — ready for maintainer review labels Nov 30, 2026
@github-actions github-actions Bot added ready for review Description complete — ready for maintainer review and removed merge conflict Conflicts with the base branch; needs a rebase before review. labels Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toast notifications disappear too quickly to read (1200ms default)

2 participants