Skip to content

ui-react: twelve browser fixtures restore an absent theme as the literal "undefined" #3914

Open

Description

@schlessera

Context

Found during the #3855 test-health push (batch e3855-ui-react-04). Assigning a saved document.documentElement.dataset.theme back with dataset.theme = saved when the saved value was undefined writes the literal string "undefined" instead of removing the attribute. #2021 records the same fault for connection-replay.layout.tsx with a native Chromium observation ({before:null,after:"undefined"}). The ui-react-04 batch fixed seven instances in its own shard (review-dialogs, renderer-dispatch, tool-permission, search-results, supporting-files, sent-attachments, saved-transcription).

A grep at d19aec478 on that batch branch (dataset.theme = <saved value> with no undefined guard) finds these instances outside that shard:

  • afterEach, packages/ui-react/tests/browser/diagrams-renderer.layout.tsx:16
  • afterEach callback list, packages/ui-react/tests/browser/diagrams-callouts.layout.tsx:40
  • afterEach, packages/ui-react/tests/browser/diagrams-node-link.layout.tsx:12
  • afterEach, packages/ui-react/tests/browser/diagrams-frame.layout.tsx:22
  • afterEach, packages/ui-react/tests/browser/mermaid-content-renderer.layout.tsx:32
  • finally, packages/ui-react/tests/browser/error-boundaries.layout.tsx:225
  • ctx.onTestFinished, packages/ui-react/tests/browser/dictation-notice.pointer.tsx:133
  • ctx.onTestFinished, packages/ui-react/tests/browser/overlay-stacking.pointer.tsx:479

The guarded form already used across the suite is if (saved === undefined) delete document.documentElement.dataset.theme; else document.documentElement.dataset.theme = saved;.

Related: #2021 (the same fault in connection-replay.layout.tsx, kept there).

Scope

Restore an absent theme attribute as absent in the eight cleanups listed above, and in these four that triage found at 91e54be37 with the same unguarded restore of a saved dataset.theme (outside ui-react-04's seven, and not fixed on epic/3855-test-health when triaged):

  • afterEach, packages/ui-react/tests/browser/code-fences.layout.tsx:16
  • afterEach, packages/ui-react/tests/browser/code-fences-plain.layout.tsx:15
  • afterEach, packages/ui-react/tests/browser/inline-graph.layout.tsx:17
  • afterEach, packages/ui-react/tests/browser/draft-indicator.offline.tsx:65

If another #3855 batch fixes one of these first, leave it. Test code only.

Out of scope

Acceptance criteria

Verification

bun scripts/test-health.ts measure <file> --runs 2 for each touched file, or the file's bun run test:layout / bun run test:browser project. One native check that the attribute is absent after a case that started without it.

Contract impact

None. Test isolation only.

Triage 2026-11-10 (main 91e54be37): verified the eight cited sites against main (the dictation-notice restore moved to :133); added four more unguarded restores found by the same grep, so the grep criterion can actually pass; state-room.layout.tsx:49 restores previousTheme ?? "dark" on purpose and is not in scope.

Activity

  1. added
    type: test
    area: ui-react
    priority: p2
    on Nov 10, 2026
  2. changed the title [-]ui-react: eight browser fixtures restore an absent theme as the literal "undefined"[/-] [+]ui-react: twelve browser fixtures restore an absent theme as the literal "undefined"[/+] on Nov 10, 2026
  3. added
    agent-ready
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-reactpriority: p2type: test

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions