Fix white underline/strikethrough lines when text or background color is applied#4032
Draft
Copilot wants to merge 4 commits into
Draft
Fix white underline/strikethrough lines when text or background color is applied#4032Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…plied Agent-Logs-Url: https://github.com/cybersemics/em/sessions/44bbc61e-f6ec-457f-881d-dff9aff156a8 Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
Agent-Logs-Url: https://github.com/cybersemics/em/sessions/44bbc61e-f6ec-457f-881d-dff9aff156a8 Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
… moving Agent-Logs-Url: https://github.com/cybersemics/em/sessions/44bbc61e-f6ec-457f-881d-dff9aff156a8 Co-authored-by: raineorshine <750276+raineorshine@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix underline and strikethrough color when applying text or background color
Fix white underline/strikethrough lines when text or background color is applied
Apr 3, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Underline and strikethrough decoration lines render white after applying text or background color, because
document.execCommand('foreColor')wraps content inside<u>/<strike>— but CSStext-decoration-colorresolves tocurrentColorof the decorating element, not its children. So<u>inherits the theme's fg color (white in dark mode) regardless of the inner<font>tag.Root cause
Changes
src/actions/formatSelection.ts— AfterforeColorexecCommand in the whole-thought case, normalizes thecontentEditableHTML to move color tags (<font>,<span>with color/background-color) outside of decoration tags (<u>,<strike>). Fires a syntheticinputevent so the debounced thought-value update picks up the corrected HTML.Two private helpers added:
isColorElement(el)— identifies<font>or<span>with color/background-colornormalizeColoredDecoration(html)— walks decoration elements bottom-up, hoisting sole color-element children above the decoration wrappersrc/e2e/puppeteer/__tests__/color.ts— Three new tests asserting the correct HTML structure after: underline + text color, underline + background color, strikethrough + text color.