block.json selectors support
-
I’m trying to set the CSS selector that is used by the typography block support for a custom block I’m developing. According to the docs that should be possible.
If I insert my block and change the font-size, the
has-small-font-size
class always get’s applied to the root element of my block. Allthough I’ve tried the following in theblock.json
:"selectors": { "root": ".box", "spacing": { "blockGap": ".box__content" }, "typography": ".box__title" } "selectors": { "root": ".box", "spacing": { "blockGap": ".box__content" }, "typography": { "root": ".box__content", "fontSize": ".box__title" } },
According to the docs page, it should work from core 6.3. on. I’m using 6.4 and the Gutenberg 17.5.
If I search the core/Gutenberg code, I can’t find places where those selectors are used in the block-supports apply functions. Could it be, that this is only used for global block styles (= changing the global style of a block via site editor global styles or via theme.json) and not on a block instance level?
If that is the case, it would be great if that is documented. Also a list of all the block supports that support selectors would be great. The
block.json
schema lists a lot of properties that the doc page does not.
- The topic ‘block.json selectors support’ is closed to new replies.