Skip to content

Global styles: add support for select or dropdown elements #70379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed to add a specific class for select elements so support is opt in
  • Loading branch information
MaggieCabrera committed Jun 16, 2025

Verified

This commit was signed with the committer’s verified signature.
commit 70a88510c4fe6f8aa63a1c002e3773e5d39c73cf
3 changes: 2 additions & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
@@ -601,12 +601,13 @@ class WP_Theme_JSON_Gutenberg {
// The block classes are necessary to target older content that won't use the new class names.
'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption',
'cite' => 'cite',
'select' => 'select',
'select' => '.wp-element-select',
);

const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array(
'button' => 'wp-element-button',
'caption' => 'wp-element-caption',
'select' => 'wp-element-select',
);

/**
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ import { unlock } from '../../lock-unlock';
const ELEMENT_CLASS_NAMES = {
button: 'wp-element-button',
caption: 'wp-element-caption',
select: 'wp-element-select',
};

// List of block support features that can have their related styles
1 change: 1 addition & 0 deletions packages/block-editor/src/elements/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const ELEMENT_CLASS_NAMES = {
button: 'wp-element-button',
caption: 'wp-element-caption',
select: 'wp-element-select',
};

export const __experimentalGetElementClassName = ( element ) => {
1 change: 1 addition & 0 deletions packages/blocks/src/api/constants.js
Original file line number Diff line number Diff line change
@@ -284,6 +284,7 @@ export const __EXPERIMENTAL_ELEMENTS = {
caption:
'.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption',
cite: 'cite',
select: '.wp-element-select',
};

// These paths may have three origins, custom, theme, and default,