@@ -659,17 +659,20 @@ dimensionsToAttrList attr = consolidateStyles $ go Width ++ go Height
659figure :: PandocMonad m
659figure :: PandocMonad m
660 => WriterOptions -> Attr -> [Inline] -> (Text, Text)
660 => WriterOptions -> Attr -> [Inline] -> (Text, Text)
661 -> StateT WriterState m Html
661 -> StateT WriterState m Html
662−figure opts attr txt (s,tit) = do
662+figure opts attr@(_, _, attrList) txt (s,tit) = do
663 html5 <- gets stHtml5
663 html5 <- gets stHtml5
664 -- Screen-readers will normally read the @alt@ text and the figure; we
664 -- Screen-readers will normally read the @alt@ text and the figure; we
665 -- want to avoid them reading the same text twice. With HTML5 we can
665 -- want to avoid them reading the same text twice. With HTML5 we can
666 -- use aria-hidden for the caption; with HTML4, we use an empty
666 -- use aria-hidden for the caption; with HTML4, we use an empty
667 -- alt-text instead.
667 -- alt-text instead.
668+ -- When the alt text differs from the caption both should be read.
668 let alt = if html5 then txt else [Str ""]
669 let alt = if html5 then txt else [Str ""]
669 let tocapt = if html5
670 let tocapt = if html5
670− then H5.figcaption !
671+ then (H5.figcaption !) $
672+ if isJust (lookup "alt" attrList)
671− H5.customAttribute (textTag "aria-hidden")
674+ else H5.customAttribute (textTag "aria-hidden")
672− (toValue @Text "true")
675+ (toValue @Text "true")
673 else H.p ! A.class_ "caption"
676 else H.p ! A.class_ "caption"
674 img <- inlineToHtml opts (Image attr alt (s,tit))
677 img <- inlineToHtml opts (Image attr alt (s,tit))
675 capt <- if null txt
678 capt <- if null txt