Skip to content

Quick Draft widget: drop a reference to a class that does not exist - #82064

Merged
retrofox merged 1 commit into
trunkfrom
fix/quick-draft-dead-class-reference
Aug 26, 2026
Merged

Quick Draft widget: drop a reference to a class that does not exist#82064
retrofox merged 1 commit into
trunkfrom
fix/quick-draft-dead-class-reference

Conversation

@retrofox

Copy link
Copy Markdown
Contributor

What?

Follow-up to reviewing #82053.

widgets/quick-draft/render.tsx picks between two CSS module classes for its root layout, but only one of them exists.

Why?

.column is not defined in widgets/quick-draft/style.module.css, and never was. In the stacked layout the ternary therefore resolves to undefined and clsx drops it, so the class list is the same either way.

Nothing renders differently: the axis is already set by direction={ listBeside ? 'row' : 'column' } on the same Stack, and .row exists only to feed the descendant selector .row .primary-pane, which adds the vertical rule in the side-by-side layout.

What the ternary does do is imply a .column modifier that is not there, sending the next reader to look for styles that do not exist.

It is also a small illustration of a gap worth naming: CSS modules are typed as { [ key: string ]: string } in typings/style-imports/index.d.ts, so a reference to a missing class type checks fine and reaches runtime as className={ undefined }. This one survived three refactors of the file without any tool noticing.

How?

Replaces the ternary with a conditional, so the class is added when it applies and nothing is added when it does not.

-			className={ clsx(
-				styles.body,
-				listBeside ? styles.row : styles.column
-			) }
+			className={ clsx( styles.body, listBeside && styles.row ) }

Testing Instructions

The change is a no-op visually; the point is to confirm that.

  1. Open the dashboard with the Quick Draft widget placed.
  2. Give the widget a wide tile, so the drafts list sits beside the form. The vertical rule between the two panes still shows.
  3. Narrow the tile until the list stacks below the form. The layout is unchanged from before this PR.

Testing Instructions for Keyboard

No interaction changes.

Screenshots or screencast

No visual changes.

Use of AI Tools

Claude Code was used to review #82053, where this dead reference surfaced, and to draft the change. Reviewed and verified before opening.

styles.column was never defined; Stack direction already handles it
@retrofox retrofox self-assigned this Aug 26, 2026
@retrofox retrofox added [Type] Code Quality Issues or PRs that relate to code quality [Feature] Dashboard WordPress admin dashboard, widget framework, and layout customization labels Aug 26, 2026
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: retrofox <retrofox@git.wordpress.org>
Co-authored-by: simison <simison@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@retrofox
retrofox requested a review from simison August 26, 2026 10:43
@github-actions

Copy link
Copy Markdown

Size Change: 0 B

Total Size: 7.91 MB

compressed-size-action

@simison simison left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@retrofox
retrofox enabled auto-merge (squash) August 26, 2026 10:58
@retrofox
retrofox merged commit ac6cb4d into trunk Aug 26, 2026
53 of 54 checks passed
@retrofox
retrofox deleted the fix/quick-draft-dead-class-reference branch August 26, 2026 11:23
@github-actions github-actions Bot added this to the Gutenberg 23.9 milestone Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Dashboard WordPress admin dashboard, widget framework, and layout customization [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants