Skip to content
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

Theme.json: __experimentalSelector not working for blocks newly adopting it #41296

Closed
aaronrobertshaw opened this issue May 25, 2022 · 0 comments · Fixed by #41569
Closed

Theme.json: __experimentalSelector not working for blocks newly adopting it #41296

aaronrobertshaw opened this issue May 25, 2022 · 0 comments · Fixed by #41569
Assignees
Labels
[Block] Image Affects the Image Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended

Comments

@aaronrobertshaw
Copy link
Contributor

aaronrobertshaw commented May 25, 2022

Description

Adding an __experimentalSelector to a server-side registered block's supports within its block.json file has no effect.

What I expected

I expected that adding __experimentalSelector to a block's supports config would override the default .wp-block-<name> selector generated by theme.json.

What happens instead

Nothing.

Extra information

  • Encountered this while attempting to add __experimentalSelector to the Image block
  • Image block is registered server-side. I also tried moving its registration to blocks.php for testing purposes.
  • Adding logging to the theme.json determination of block selectors shows that core blocks haven't yet been reregistered with Gutenberg's so the theme.json function only has the block's metadata from core i.e. the outdated block.json from core.

Step-by-step reproduction instructions

  1. Add supports.__experimentalSelector to the image block.json file and set it to ".wp-block-image img"
  2. Via global styles or your theme's theme.json, configure a border radius
  3. Reload the block editor
  4. Inspect the image block or the theme.json generated stylesheet and notice that the block's selector is still .wp-block-image not the selector you set i.e. .wp-block-image img

Screenshots, screen recording, code snippet

No response

Environment info

  • WP 5.9 and WP 6.0
  • Gutenberg latest from trunk

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

@aaronrobertshaw aaronrobertshaw added [Type] Bug An existing feature does not function as intended [Block] Image Affects the Image Block Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels May 25, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jun 7, 2022
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants