Skip to content

Components: Standardize input field labels to sentence case#77202

Open
JanaMW27 wants to merge 3 commits into
WordPress:trunkfrom
JanaMW27:fix/label-sentence-case
Open

Components: Standardize input field labels to sentence case#77202
JanaMW27 wants to merge 3 commits into
WordPress:trunkfrom
JanaMW27:fix/label-sentence-case

Conversation

@JanaMW27

@JanaMW27 JanaMW27 commented Apr 9, 2026

Copy link
Copy Markdown

What?

Remove text-transform: uppercase from BaseControl labels and text-transform: capitalize from DataForm panel labels, replacing ALL CAPS styling with sentence case.

Update label typography to use design system type tokens: fontSize (13px), fontWeightMedium (499), and foreground color — matching the individual tokens used by the heading-md variant.

Why?

Input field labels use ALL CAPS while other form elements (checkboxes, toggles, radio buttons) already use sentence case. This inconsistency hurts readability, accessibility (screen readers, dyslexia), and internationalization (languages without uppercase).

Closes #76673

How?

  • packages/components/src/utils/base-label.ts: Removed text-transform: uppercase, updated font-size from 11px to CONFIG.fontSize (13px), added color: COLORS.theme.foreground.
  • packages/dataviews/src/components/dataform-layouts/panel/style.scss: Removed text-transform: capitalize, updated color from $gray-700 to $gray-900.

Note: DataViews table headers intentionally keep ALL CAPS per design system guidance — they are not affected by this change.

Testing Instructions

  1. Open the block editor and inspect input field labels (e.g., Typography panel, Dimensions panel).
  2. Verify labels display in sentence case (not ALL CAPS).
  3. Check DataForm panel labels match the updated style.
  4. Confirm DataViews table column headers remain in ALL CAPS.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Remove `text-transform: uppercase` from BaseControl labels and
`text-transform: capitalize` from DataForm panel labels, replacing
ALL CAPS styling with sentence case for improved readability,
accessibility, and internationalization consistency.

Update label font-size from 11px to 13px and color to foreground
(gray-900) to match heading-md type tokens per design system guidance.

Closes WordPress#76673

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added [Package] Components /packages/components [Package] DataViews /packages/dataviews labels Apr 9, 2026
@github-actions

github-actions Bot commented Apr 9, 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.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @JanaMW27.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

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

Unlinked contributors: JanaMW27.

Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Co-authored-by: poligilad-auto <poligilad@git.wordpress.org>

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

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Components, First-time Contributor, [Package] DataViews.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Components, [Package] DataViews.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions github-actions Bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Apr 9, 2026
@github-actions

github-actions Bot commented Apr 9, 2026

Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @JanaMW27! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@JanaMW27

JanaMW27 commented Apr 9, 2026

Copy link
Copy Markdown
Author

BEFORE / AFTER screenshots:

BEFORE

BEFORE1 BEFORE2

AFTER:

AFTER1 AFTER2

@oandregal oandregal requested a review from jameskoster April 9, 2026 17:17

@ciampo ciampo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll keep my review focused on the code changes, letting @jameskoster and other folks from @WordPress/gutenberg-design handle the design part.

A few general comments, on top of dedicated inline feedback:

  • we should re-generate snapshots;
  • we should add CHANGELOG entries as needed (components package, dataviews package)

Most notably, the changes in this PR are not comprehensive. Several components duplicate the 11px + uppercase pattern outside baseLabelTypography and are currently remaining unchanged, potentially introducing more discrepancies than it aims to fix.

Here is a detailed audit

Audit: Components left behind with old 11px + uppercase label styles

This PR updates baseLabelTypography (which only has 2 consumers: BaseControl labels and InputControl labels) and one DataForm panel SCSS rule. However, many other locations across the codebase hardcode the same font-size: 11px; text-transform: uppercase; font-weight: 499 pattern independently and would not be updated, creating a patchwork of old and new label treatments.

Same package (@wordpress/components)

Component File Context
ColorHeading src/color-palette/styles.ts Section heading for color palettes
PaletteHeading src/palette-edit/styles.ts Section heading for palette editor
ResetLabel src/tools-panel/styles.ts "Reset" label in ToolsPanel dropdown
MenuGroup label src/menu-group/style.scss Group labels in dropdown menus

ResetLabel is particularly notable — it sits visually adjacent to the field labels this PR modifies, so the inconsistency would be immediately visible in any ToolsPanel.

Other packages

Package Selector / File Context
block-editor .block-editor-inserter__panel-title in inserter/style.scss Section labels in the block inserter
block-editor .block-editor-block-navigation__label in block-navigation/style.scss Block navigation labels
block-library .link-control-transform__subheading in navigation-link/editor.scss Subheading in link transform UI
block-library video/editor.scss Video track editor labels
interface complementary-area/style.scss — sidebar h3 Inspector panel section subheadings
edit-site sidebar-navigation-screen-patterns/style.scssh2 Site editor sidebar section headers
global-styles-ui .global-styles-ui-subtitle in style.scss Global styles subtitles
global-styles-ui font-library/style.scss (3 selectors: subtitle, page-selection, fonts-title) Font library modal
editor entities-saved-states/style.scss Save entities panel button label
commands [cmdk-group-heading] in style.scss Command palette group headings

DataViews (intentionally kept per the PR description)

Selector / File Context
th and .dataviews-view-table-header-button in table/style.scss Table column headers
dataviews-pagination/style.scss Pagination label (less clearly intentional)

Native / Mobile

File Context
text/styles/text-mixins.native.jssectionHeading variant Exact native equivalent of baseLabelTypography — native labels will diverge from web

Snapshot files that will need regeneration

  • packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap (4 occurrences)
  • packages/editor/src/components/post-publish-panel/test/__snapshots__/index.js.snap (2 occurrences)
  • packages/block-editor/src/components/color-palette/test/__snapshots__/control.js.snap (1 occurrence)

New design system (@wordpress/ui)

packages/ui/src/utils/css/field.module.css also uses text-transform: uppercase + font-size: var(--wpds-font-size-xs) for field labels. If the token resolves to 11px, the new design system would also retain the old pattern.


Summary: ~17+ locations across the codebase hardcode the same visual pattern and would remain on the old 11px + uppercase style. The most jarring inconsistencies would appear within the same panels (e.g., ResetLabel in ToolsPanel, inserter section titles, command palette group headings) where old and new styles coexist side by side.

font-weight: ${ CONFIG.fontWeightMedium };
line-height: 1.4;
text-transform: uppercase;
color: ${ COLORS.theme.foreground };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is the right place to add a color rule — this mixin is specifically aimed at typography rules (not color), as the JSDoc suggests.

For example, BaseControl deliberately sets color at the component level — StyledHelp uses color: COLORS.gray[700] while the label relied on color inheritance. The InputControl's BaseLabel also has no explicit color, likely relying on cascaded or inherited color for different contexts (e.g., disabled states, dark themes, accent-colored containers).

If the intent is to ensure foreground color on labels, that should be applied in the consumers (StyledLabel, StyledVisualLabel, BaseLabel), not in the shared typography mixin.

* Internal dependencies
*/
import CONFIG from './config-values.js';
import { COLORS } from './colors-values';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should be consistent in our import paths — ie. adding the .js extension as in the line above

Suggested change
import { COLORS } from './colors-values';
import { COLORS } from './colors-values.js';

// Try to use BaseControl's StyledLabel or BaseControl.VisualLabel if you can.
export const baseLabelTypography = css`
font-size: 11px;
font-size: ${ CONFIG.fontSize };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change causes a font size jump from 11px to 13px, which I guess is what @jameskoster also highlighted in the original issue:

One observation is that this change would result in a minor loss of typographical hierarchy in the block inspector.

- Remove color from baseLabelTypography mixin (typography-only)
- Apply foreground color in BaseControl and InputControl consumers
- Regenerate snapshots (7 updated)
- Add CHANGELOG entries for components and dataviews packages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JanaMW27 JanaMW27 requested a review from ellatrix as a code owner April 10, 2026 13:10
@github-actions github-actions Bot added [Package] Editor /packages/editor [Package] Block editor /packages/block-editor labels Apr 10, 2026
@JanaMW27

Copy link
Copy Markdown
Author

Thanks for the thorough review @ciampo! I've pushed a follow-up commit addressing your inline feedback:

  • Color moved out of the typography mixinbaseLabelTypography is now purely typography. The color: foreground is applied in the consumers (StyledLabel/StyledVisualLabel in BaseControl and BaseLabel in InputControl) instead.
  • Import extension fixed — removed the unnecessary COLORS import from base-label.ts entirely since color is no longer set there.
  • Snapshots regenerated — 7 snapshots updated across 3 test suites.
  • CHANGELOG entries added — for both @wordpress/components and @wordpress/dataviews.

Regarding the font-size jump (11px → 13px) and the comprehensive audit of ~17 other locations with hardcoded 11px + uppercase:

@jameskoster — could you weigh in on two questions?

  1. Font size: Should labels use 13px (matching heading-md tokens) or stay at 11px/12px for hierarchy? The 11→13 jump is noticeable.
  2. Scope: Should this PR also update the other ~17 locations ciampo identified (e.g., ColorHeading, PaletteHeading, ResetLabel, inserter panel titles, etc.), or should those be handled in follow-up PRs?

Happy to adjust either way — just want to make sure we're aligned on the design intent before expanding scope.

@jameskoster

Copy link
Copy Markdown
Contributor

For me the labels should be 13px. But I'd also try normal font-weight; the heavier weight is causing some tension between panel headings and labels:

Screenshot 2026-04-10 at 14 30 28

The most jarring inconsistencies would appear within the same panels (e.g., ResetLabel in ToolsPanel, inserter section titles, command palette group headings) where old and new styles coexist side by side.

To be sure I'm not missing something, this is already the case on trunk:

Screenshot 2026-04-10 at 14 38 01 Screenshot 2026-04-10 at 14 38 37

If it's not a label we shouldn't touch it in this PR, imo. I think the 11px all-caps style is still valid for small headings and certain buttons (DataViews table column headers).

Change font-weight from fontWeightMedium (499) to fontWeight (normal)
to reduce visual tension between panel headings and labels, as
suggested by @jameskoster. Regenerate snapshots.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JanaMW27

JanaMW27 commented Apr 10, 2026

Copy link
Copy Markdown
Author

New BEFORE / AFTER with the 400 weight

BEFORE

BEFORE1 BEFORE2

AFTER

Screenshot 2026-04-10 at 16 02 16 Screenshot 2026-04-10 at 16 02 10

cc @poligilad-auto for awareness that we are going with the 400 weight rather than the 500 weight

@jameskoster

Copy link
Copy Markdown
Contributor

@JanaMW27 are we still wanting to pursue this?

@JanaMW27

JanaMW27 commented Apr 29, 2026

Copy link
Copy Markdown
Author

I think it would be a general improvement to the DS but I am not 100% sure if its necesary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Block editor /packages/block-editor [Package] Components /packages/components [Package] DataViews /packages/dataviews [Package] Editor /packages/editor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize input field labels to sentence case

3 participants