Gallery block: Strip HTML from caption before using as alt attribute. #26549
Labels
[Block] Gallery
Affects the Gallery Block - used to display groups of images
[Status] In Progress
Tracking issues with work in progress
[Type] Bug
An existing feature does not function as intended
Describe the bug
Per #26082, in the gallery block, for an image without an
alt
text specified, we're using the image's caption as a fallback. However, the caption can contain HTML (e.g. a link, i.e. an<a />
tag) that we should strip from it when using it asalt
text.To reproduce
Steps to reproduce the behavior:
alt
attribute includes the HTML (<a />
element).Expected behavior
HTML should be removed from the caption when used as
alt
attribute.Screenshots
N/A
Editor version (please complete the following information):
Brought up here. When used with other plugins, there can be issued with incorrectly mangled HTML in attributes, see e.g. Automattic/wp-calypso#46813.
cc/ @ZebulanStanphill
The text was updated successfully, but these errors were encountered: