Repository navigation
fix(gantt): restore readable outside-text for done tasks in dark mode - #7456
Conversation
…k mode
When a Gantt done-task label is too wide to fit inside the bar, the renderer
places the text outside (next to the bar) with class `taskTextOutsideLeft` or
`taskTextOutsideRight` plus `doneText{N}`. The `.doneText{N}` rule uses
`taskTextDarkColor !important`, which PR #7432 changed to a dark color
(inverted from lightgrey) for contrast inside the bar. That `!important` also
overrides the lighter `taskTextOutsideColor` that `.taskTextOutside{N}` sets,
making outside-label text black/dark on the dark diagram background.
Fix: add combined-class selectors (`.doneText{N}.taskTextOutsideLeft/Right`)
after the `.doneText{N}` block, using `taskTextOutsideColor !important`. The
combined selectors have higher specificity and appear later in the cascade, so
they win over the single-class rule. Same fix applied to `.doneCritText{N}`.
Fixes regression from PR #7432 (fix for #5979).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers the regression from #7433 where done-task labels displayed outside the bar (text too wide for the bar width) rendered in unreadable dark color in dark theme. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…done tasks Split the dark mode done-task coverage into two explicit tests: - inside-text: label fits within the bar (long bar, short label) - outside-text: label overflows the bar (short bar, long label) — regression case for #7433 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 48ce939 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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7456 +/- ##
=========================================
- Coverage 3.59% 3.53% -0.06%
=========================================
Files 475 494 +19
Lines 47191 49068 +1877
Branches 735 770 +35
=========================================
+ Hits 1696 1735 +39
- Misses 45495 47333 +1838
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
There was a problem hiding this comment.
[sisyphus-bot]
Review — fix(gantt): restore readable outside-text for done tasks in dark mode
Thanks for catching and fixing this regression quickly! The analysis in the PR description is clear and the CSS cascade reasoning is spot-on.
What's working well
🎉 [praise] Excellent root-cause analysis in the PR body — tracing the specificity conflict between .doneText{N} and .taskTextOutside{N} through the !important cascade makes the fix easy to verify. This is exactly how regression fix PRs should be documented.
🎉 [praise] Great test coverage — the three new e2e tests cover both inside-bar and outside-bar done text in dark mode, plus done-crit outside text. The use of a 1-day bar with a long label is a smart way to force the outside-text code path.
Things to address
🟢 [nit] The e2e test title references #7433 ("regression #7433" at cypress/integration/rendering/gantt.spec.js), but #7433 is the type-fest dependency PR. Based on the PR body, the regression was introduced by #7432 (the fix for #5979). Minor, but worth fixing so future archaeology leads to the right commit — suggest changing the test name to reference #7432.
Security
No XSS or injection issues identified. The new ${options.taskTextOutsideColor} interpolations follow the exact same pattern already used throughout styles.js. Theme variables are validated against a strict allowlist regex in sanitizeDirective.ts, compiled through stylis, and the final SVG is sanitized by DOMPurify. No new attack surface introduced.
Summary
Clean, focused regression fix. The CSS approach (combined-class selectors winning by both specificity and source order) is correct and maintainable. The changeset is appropriate (patch bump). Just the base branch question to resolve — let's get this across the finish line!
* 'master' of https://github.com/mermaid-js/mermaid: fix(gantt): restore readable outside-text for done tasks in dark mode (#7456) fix(elk): scope rounded edge curve to ELK layout only (#7454)
* changeset-release/master: fix pnpm lock file Fix: ER diagram edge label positioning (#7453) chore: Update coupon fix(gantt): restore readable outside-text for done tasks in dark mode (#7456) fix(elk): scope rounded edge curve to ELK layout only (#7454) Version Packages fix: plausible build chore: Update plausible chore: Update release version in docs chore: Track editor picker selection fix: update broken docsy link and exclude bot-blocked domains from link checker chore: replace MERMAID_RELEASE_VERSION placeholders with current version fix: correct package name in changeset slow-lemons-know Updated Hero text Version Packages Fixed issue with hero text chore: Update banner with coupon Update link with source Updating the Hero on the docs side # Conflicts: # .changeset/rounded-edge-curves.md # .changeset/weak-tools-pay.md # cypress/integration/rendering/flowchart-v2.spec.js # packages/mermaid/CHANGELOG.md # packages/mermaid/src/rendering-util/createText.ts # packages/mermaid/src/rendering-util/rendering-elements/edges.js # packages/tiny/CHANGELOG.md # pnpm-lock.yaml
* master: (24 commits) Version Packages (#7561) Release candidate 11.14.0 (#7526) chore: Editor Picker V2 (#7497) Setting the link to Get started to the correct on Version Packages (#7466) fix: use correct package name for elk dummy commit Fix: ER diagram edge label positioning (#7453) chore: Update coupon fix(gantt): restore readable outside-text for done tasks in dark mode (#7456) fix(elk): scope rounded edge curve to ELK layout only (#7454) fix: plausible build chore: Update plausible chore: Update release version in docs chore: Track editor picker selection fix: update broken docsy link and exclude bot-blocked domains from link checker chore: replace MERMAID_RELEASE_VERSION placeholders with current version fix: correct package name in changeset slow-lemons-know Updated Hero text Version Packages ... # Conflicts: # .changeset/weak-tools-pay.md # docs/syntax/architecture.md # docs/syntax/timeline.md # docs/syntax/treeView.md # docs/syntax/wardley.md # docs/syntax/xyChart.md # packages/examples/CHANGELOG.md # packages/examples/package.json # packages/mermaid/CHANGELOG.md # packages/mermaid/package.json # packages/mermaid/src/diagrams/git/gitGraphRenderer.ts # packages/mermaid/src/docs/.vitepress/components/EditorSelectionModal.vue # packages/mermaid/src/docs/syntax/architecture.md # packages/mermaid/src/docs/syntax/timeline.md # packages/mermaid/src/docs/syntax/treeView.md # packages/mermaid/src/docs/syntax/wardley.md # packages/mermaid/src/docs/syntax/xyChart.md # packages/mermaid/src/rendering-util/rendering-elements/shapes/requirementBox.ts # packages/parser/CHANGELOG.md # packages/parser/package.json # packages/tiny/CHANGELOG.md # packages/tiny/package.json
Summary
Regression fix for a side-effect introduced by PR #7432 (fix for #5979).
taskTextOutsideLeft/taskTextOutsideRightcombined withdoneText{N}..doneText{N}rule usestaskTextDarkColor !important. PR fix(gantt): readable done-task text in dark theme #7432 changedtaskTextDarkColorin the dark theme to a dark color (inverted fromlightgrey) for contrast inside the bar.!importantalso overrides the lightertaskTextOutsideColorset by.taskTextOutside{N}, making outside-label text black/dark on the dark diagram background — unreadable.Fix: Add combined-class selectors (
.doneText{N}.taskTextOutsideLeft/Right) after the.doneText{N}block, usingtaskTextOutsideColor !important. Same applied to.doneCritText{N}. The combined selectors appear later in the cascade and win by both specificity and source order.Changes
packages/mermaid/src/diagrams/gantt/styles.js— two new CSS override blocks for outside done/done-crit task textcypress/integration/rendering/gantt.spec.js— three e2e snapshot tests covering inside-bar and outside-bar done task text in dark theme.changeset/fix-gantt-done-outside-text-dark.md— patch changesetVerification
pnpm vitest run packages/mermaid/src/themes/)🤖 Generated with Claude Code