WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

SelectControl custom classes applied incorrectly #50359

Open picocodes opened 1 year ago

picocodes commented 1 year ago

Description

Other input controls apply the custom CSS classes to the parent BaseControl component. SelectControl, on the other hand, applies the custom CSS classes to the inner InputBase component.

This makes it impossible to apply custom CSS styles.

Step-by-step reproduction instructions

Check https://github.com/WordPress/gutenberg/blob/trunk/packages/components/src/select-control/index.tsx#L98

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

mirka commented 7 months ago

Oof, this is indeed a mistake, and something that cannot be easily fixed in a backward compatible way 😅

I can only suggest things like using a wrapper div, or a parent selector like .components-base-control:has(.my-select-control-class).