Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
While working on the list block, I thought it might be fun to try to create a list block with
InnerBlocks
. Perhaps more useful would be to start with something new like a checklist block. This allows us to experiment withInnerBlocks
more before eventually moving on to more complicated scenarios like nesting.A checklist block also comes with a few challenges. There's no standard HTML structure for it.
Option 1:
The advantage of this structure is that it will be indented just like other list blocks that are styled by the theme. But we end up with two prefixes: the bullet (or number in case of an ordered list) and the checkbox. Usually the bullet is removed, and the checkbox positioned where the bullet is. This is no easy task to get right for all times though. It also excludes the possibility to create a numbered checklist. Keeping both (the bullet or number) and the checkbox seems the easiest: there's no need for styling, it works for all themes, and it's possible to number the list items. If themes want, they can also remove the bullet for an unordered list and position the checkbox.
Option 2:
I'm not sure if the previous example would need a label, but it's also possible to not put the items in a list element at all. The block becomes a bit less complex as there's no need for a wrapper block (
ol
orul
), but the items won't be indented like other list items styled by the theme.How has this been tested?
Screenshots
Types of changes
Checklist: