From 138e64009ddb2d4c30c2f00de9cb1c0f715d53d0 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Mon, 2 Nov 2020 18:36:41 +0100 Subject: [PATCH] Add explanation comment for stripping the `alt` HTML Co-authored-by: Bernie Reiter --- packages/block-library/src/gallery/save.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/block-library/src/gallery/save.js b/packages/block-library/src/gallery/save.js index 11feb8412b2491..a77a0761cb83ec 100644 --- a/packages/block-library/src/gallery/save.js +++ b/packages/block-library/src/gallery/save.js @@ -41,6 +41,10 @@ export default function save( { attributes } ) { break; } + // image.caption comes from a RichText component, so it can contain + // HTML that we need to strip. In GB 9.2, image.alt would fall back to + // image.caption without stripping the HTML, so we also run it through + // __unstableStripHTML here. let alt = image.alt || image.caption; if ( alt && alt !== __unstableStripHTML( alt ) ) {