@@ -191,6 +191,11 @@ local calloutidx = 1
191191local function calloutDiv (node )
192192 node = decorate_callout_title_with_crossref (node )
193193
194+ local needs_screen_reader_callout_type = true
195+ if is_valid_ref_type (refType (node .attr .identifier )) then
196+ needs_screen_reader_callout_type = false
197+ end
198+
194199 -- the first heading is the title
195200 local div = pandoc .Div ({})
196201 local c = quarto .utils .as_blocks (node .content )
@@ -218,6 +223,7 @@ local function calloutDiv(node)
218223
219224 if calloutAppearance == _quarto .modules .constants .kCalloutAppearanceDefault and pandoc .utils .stringify (title ) == " " and not found then
220225 title = quarto .utils .as_inlines (pandoc .Plain (displayName (node .type )))
226+ needs_screen_reader_callout_type = false
221227 end
222228
223229 -- Make an outer card div and transfer classes and id
@@ -262,6 +268,12 @@ local function calloutDiv(node)
262268 -- show a titled callout
263269 if title ~= nil and (pandoc .utils .type (title ) == " string" or next (title ) ~= nil ) then
264270
271+ if needs_screen_reader_callout_type then
272+ -- add a screen reader callout type
273+ local srCalloutType = pandoc .Span (pandoc .Str (displayName (callout_type )))
274+ srCalloutType .attr .classes :insert (" screen-reader-only" )
275+ title :insert (1 , srCalloutType )
276+ end
265277 -- mark the callout as being titleed
266278 calloutDiv .attr .classes :insert (" callout-titled" )
267279
0 commit comments