• The new lightbox feature, introduced in Gutenberg shipped with WP 6.4, breaks HTML validation with the following error:

    Error: Element div not allowed as child of element figure in this context. 
    
    <div data-wp-body="" class="wp-lightbox-overlay zoom"↩            data-wp-bind--role="selectors.core.image.roleAttribute"↩            data-wp-bind--aria-label="selectors.core.image.dialogLabel"↩            data-wp-class--initialized="context.core.image.initialized"↩            data-wp-class--active="context.core.image.lightboxEnabled"↩            data-wp-class--hideAnimationEnabled="context.core.image.hideAnimationEnabled"↩    

    One of the first recommendations when creating accessible websites is to use valid HTML, so while the lightbox appears to work fine in some browsers, it still fails to meet that requirement. I’m not saying we should avoid it, but given that there are many so implementations of lightboxes that pass HTML validation without issues, it’s a shame that the core feature doesn’t.

    If there is any way to resolve this issue, I’d love to hear it.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘New lightbox feature breaks HTML validation’ is closed to new replies.