LearnNewsExamplesServices
Frontmatter
id18171
titleA pressed tab button''s contrast colours never apply: the selector wants a descendant that does not exist
stateClosed
labels
bugdesignaiarchitecture
assigneesneo-opus-grace
createdAtSep 3, 2026, 10:32 AM
updatedAtSep 3, 2026, 8:13 PM
githubUrlhttps://github.com/neomjs/neo/issues/18171
authorneo-opus-grace
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 3, 2026, 8:13 PM

A pressed tab button's contrast colours never apply: the selector wants a descendant that does not exist

Closed v13.2.0/archive-v13-2-0-chunk-18 bugdesignaiarchitecture
neo-opus-grace
neo-opus-grace commented on Sep 3, 2026, 10:32 AM

DECISION (2026-09-03): the fork below is RESOLVED to A — "deliver the full intent", on @tobiu's authority. The disposition table is kept as the record of the question that was open; it is not a live choice. Rationale, the operator's words, and the inherit provenance that supports A are in the decision comment. Delivered by #18212.

Context

Found while sweeping tab/header/Button.scss for #18145 batch 3 (#18170), which excluded the file rather than porting a rule that does not work.

theme-neo-light/tab/header/Button.scss and theme-neo-dark/tab/header/Button.scss each end with:

    // custom overrides
    .neo-tab-header-button.neo-button {
        .pressed {
            .neo-button-glyph, .neo-button-text {
                color: var(--sem-color-fg-neutral-contrast);
            }
        }
    }

The emitted selector is …​.neo-tab-header-button.neo-button .pressed .neo-button-glyph — .pressed as a descendant of the button.

The Problem

pressed is never a descendant. It is the button itself.

src/button/Base.mjs:386 — afterSetPressed toggles the class onto the component's own cls:

NeoArray.toggle(cls, 'pressed', value === true);

and src/button/Base.mjs's vdom gives the button exactly four children:

{tag: 'button', type: 'button', cn: [
    {tag: 'span', cls: ['neo-button-glyph']},
    {tag: 'span', cls: ['neo-button-text']},
    {cls: ['neo-button-badge']},
    {cls: ['neo-button-ripple-wrapper'], cn: [{cls: ['neo-button-ripple']}]}
]}

None of them ever receives pressed, and src/tab/Container.mjs:483 only sets the pressed config on tab buttons, which routes through the same afterSetPressed. So the rule requires a descendant that no code path creates: it cannot match, and never has.

The structural sheet states the same intent correctly, one element up — src/tab/header/Button.scss:67 uses &.pressed, the self-scoped form, and reads --tab-button-glyph-color-pressed from it.

The Architectural Reality

  • resources/scss/theme-neo-light/tab/header/Button.scss · resources/scss/theme-neo-dark/tab/header/Button.scss — the dead block.
  • resources/scss/src/tab/header/Button.scss:67 — &.pressed, the working form, already reading --tab-button-glyph-color-pressed and --tab-button-height-pressed.
  • Both neo themes declare --tab-button-glyph-color-pressed: inherit, so a pressed tab's glyph currently takes the button's text colour. The dead block was evidently meant to give glyph and text --sem-color-fg-neutral-contrast instead.

Two dispositions, and they are not equivalent — this needed a decision, not a mechanical fix. A was chosen.

change consequence
A — deliver the intent ✅ CHOSEN move the pair into the theme's flat tokens and let src's &.pressed block read them a pressed tab's glyph and text repaint in both neo themes. Visible, and it is the design someone wrote and never got.
B — delete the block remove it as dead zero paint change; the design intent is discarded rather than delivered

A is the honest reading of what the author meant, and it changes rendering in two themes, so it wanted the design eye rather than a refactor's. It got one: @tobiu ruled "deliver the full intent" on 2026-09-03, after a parity check showed both classic themes already carry a concrete pressed glyph colour while both neo themes said inherit — which makes A a delivery rather than new design. B is recorded below as the option not taken.

The Fix

Under either disposition the block could not survive as-is: #18145's rule sends variant-scoped values into scss/src reading flat tokens, and a rule that matches nothing cannot be ported faithfully.

For A: src/tab/header/Button.scss's existing &.pressed block gains .neo-button-text { color: var(--tab-button-text-color-pressed); } beside its .neo-button-glyph rule; both neo themes declare --tab-button-text-color-pressed and change --tab-button-glyph-color-pressed from inherit to var(--sem-color-fg-neutral-contrast); and — per #18141 — every theme with a tab/header/ sheet declares the new token, classic values included, so a nested theme boundary resets rather than inherits.

For B: delete both blocks; no token, no src change.

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
--tab-button-text-color-pressed resources/scss/src/tab/header/Button.scss (A only) new token read by the existing &.pressed block declared by every theme carrying a tab/header/ sheet, so nothing inherits across a nested boundary SCSS comment emitted-CSS diff per theme
--tab-button-glyph-color-pressed same (A only) neo themes change inherit → the contrast token unchanged in classic themes SCSS comment same
theme .neo-tab-header-button.neo-button .pressed block theme-neo-{light,dark}/tab/header/Button.scss removed under both dispositions none — it matches nothing today n/a the vdom/cls evidence above

Decision Record impact

none — no ADR governs tab header button chrome.

Acceptance Criteria

  • AC-1 — the dead block is gone from both neo theme sheets.
  • AC-2 — the chosen disposition is stated in the PR body with its paint consequence, not inferred from the diff.
  • AC-3 (A only) — every theme with a tab/header/ sheet declares each new token; verified by an exact-name set count across themes, not by eye.
  • AC-4 — emitted CSS compared per theme before and after; under B the diff is deletion only and zero computed values change, under A the changed values are named.
  • AC-5 — a component arm asserts the pressed tab button's glyph and text computed colour, so the rule's effect is witnessed rather than its presence. Under B the arm records today's colours as the intended baseline.
  • AC-6 (red-first, A only) — the arm fails at the current head, because the block it depends on matches nothing.
  • AC-7 — exact-head unit + component suites green.

Out of Scope

  • The rest of #18145's sweep; this file is excluded from it until this is decided.
  • dialog/Base.scss, excluded from the same batch for an unrelated cascade reason — see #18170.
  • --tab-button-height-pressed and the other working &.pressed values, which are correct today.

Avoided Traps

  • Porting it faithfully. #18145 says move variant-scoped selectors into scss/src. Doing that here would reproduce a selector that matches nothing, in a place where it is harder to notice.
  • Fixing it inside a refactor. Changing .pressed to &.pressed while moving the file is a one-character diff with a visible paint change in two themes, arriving in a PR whose stated contract is "no unintended differences".
  • Reading "dead" as "safe to delete". It is dead, and it is also the only record that someone intended pressed tabs to use the contrast colour. Deleting silently discards a design decision; that is disposition B, and it should be chosen rather than defaulted into.

Related

  • #18145 — the sweep that surfaced it; this file is excluded there.
  • #18170 — batch 3, which excludes both this file and dialog/Base.scss with measurements.
  • #18141 — why every theme must declare a token rather than omit it.
  • #18107 — the sibling theme sweep.

Live latest-open sweep: checked the 20 latest open issues at 2026-09-03T08:32Z; no equivalent found. Duplicate sweep over pressed / tab header button selectors returned #18020 (closed, drag-proxy density) and #17418 (closed, flat header actions) — neither concerns this selector.

Origin Session ID: 8d936ec9-b816-4ded-a91e-6e91ef6a3325

Retrieval Hint: "dead pressed selector tab header button descendant vs self-scoped neo theme never matched"