Skip to content

Fix invisible text in composer code-block textarea - #49

Merged
Aztec03hub merged 1 commit into
mainfrom
fix-block-textarea-invisible-text
Jun 26, 2026
Merged

Fix invisible text in composer code-block textarea#49
Aztec03hub merged 1 commit into
mainfrom
fix-block-textarea-invisible-text

Conversation

@Aztec03hub

Copy link
Copy Markdown
Owner

Problem

Text typed into the composer's dedicated multi-line code block textarea was invisible. Only the caret and a faint ember selection tint showed (plus the red spellcheck squiggle).

Root cause

The inline composer textarea uses a "transparent-glyph + overlay" technique: the inline <textarea> is color: transparent and a separate .input-overlay paints the visible, syntax-highlighted text. That transparency rule was written as the broad descendant selector .input-wrap textarea (specificity 0,1,1).

The dedicated block-mode textarea (.block-textarea, specificity 0,1,0) lives inside .input-wrap, so the broad rule beat .block-textarea's own color and forced its glyphs to transparent. The color token itself was fine; this was purely a specificity bleed.

Fix

Scope the overlay-transparency rules to the inline textarea via a dedicated .inline-textarea class, for every rule that previously targeted any .input-wrap textarea:

  • .input-wrap textarea -> .input-wrap textarea.inline-textarea (base, color: transparent)
  • the same scoping for ::selection, ::placeholder, :focus-visible, and ::-webkit-scrollbar

The block textarea now keeps its own visible --code-block-fg / --text-primary color and a normal visible selection (an explicit .block-textarea::selection rule paints visible glyphs over the ember tint). The inline transparent-glyph + overlay technique is byte-for-byte unchanged, including the transparent inline selection that prevents the documented "doubled text" regression.

Tests

New web/tests/message-input-block-textarea-visible.spec.js asserts the cascade outcome (not just that a class exists): it parses the component's real <style> rules and uses element.matches() against the live rendered DOM after entering block mode.

  • No transparent-color rule applies to the block textarea
  • A visible-color rule does apply to the block textarea
  • The inline textarea is still targeted by a transparent-glyph rule (overlay technique intact)
  • Block ::selection is visible; inline ::selection stays transparent

Proven non-vacuous: all 3 tests fail against the pre-fix component.

Gates

  • Svelte autofixer: 0 issues (output byte-identical to main; only pre-existing advisories remain)
  • pnpm --dir web test: 1292 passed (94 files), 0 unhandled errors
  • pnpm --dir web build: green

🤖 Generated with Claude Code

The dedicated block-mode textarea (.block-textarea) rendered typed code
invisible: the inline composer's "transparent-glyph + overlay" rule was
written as the broad descendant selector `.input-wrap textarea`
(specificity 0,1,1), which beat `.block-textarea` (0,1,0) and forced the
block textarea's glyphs to `color: transparent`. Only the caret and the
ember selection tint showed.

Scope the overlay-transparency rules to the inline textarea via a
dedicated `.inline-textarea` class (base, ::selection, ::placeholder,
:focus-visible, ::-webkit-scrollbar). The block textarea now keeps its
own visible `--code-block-fg`/`--text-primary` color and a normal,
visible selection. The inline transparent-glyph + overlay technique
(including the transparent selection that prevents the documented
"doubled text" regression) is unchanged.

Adds a regression test that proves the cascade outcome via element
matches() against the rendered DOM: no transparent-color rule applies to
the block textarea, a visible-color rule does, and the inline textarea is
still targeted by a transparent-glyph rule.
@Aztec03hub
Aztec03hub merged commit 0e6fc49 into main Jun 26, 2026
7 checks passed
@Aztec03hub
Aztec03hub deleted the fix-block-textarea-invisible-text branch June 26, 2026 01:49
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.

1 participant