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

Enhance gutenberg validation #1387

Open
chindris opened this issue Jul 3, 2023 · 0 comments
Open

Enhance gutenberg validation #1387

chindris opened this issue Jul 3, 2023 · 0 comments

Comments

@chindris
Copy link
Contributor

chindris commented Jul 3, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant