-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Currently, when a Gutenberg block gets validated, the GutenbergValidator plugin does not know anything about the context of that block (for example the parent of the block or even the entire document). In some cases, this is useful. Consider this real scenario (from LGT): we have a hero block and a CTA list block. In each of these blocks we can have a list of CTAs, however, the one from the hero block is enabled based on a setting. Inside the CTA list, there are link elements which have validations (for example, a link cannot be empty). If the user just enables the CTA on the hero, and then disables it, an empty element gets already created in the document, which will then be validated.
So in above case, the validation of the elements should happen only if the display setting is ON.
When combined with another feature, to filter out empty blocks from the document: #1388 , we can also make sure that we don't end up with, for example, empty placeholders in the frontend.