figure
and figcaption
This page is in development and will probably change over the next few days.
Please provide results explaining what happens in the various cases, either as pull requests in github, by email to chaals@yandex-team.ru, or as comments on HTML issue 177.
The HTML 5 specification states that a figure
element may have zero or one <figcaption>
children, which must be the first or last child of a figure element.
This page provides some tests to determine whether there is any reason to make the restriction on either number or placement of figcaption
children of a figure
element, based on interoperability requirements.
Rough, obviously. All results on Mac OS 10.10.5 using VoiceOver. Safari 9.1 seems not to implement figure at all. Yandex 16.3 and Firefox 45 both report the figure, respectively as a figure and a group. They include text alternatives for individual images, and all figcaption
elements found as children anywhere in the figure
, as the text alternative for the figure.
In this case there is a paragraph of text, a second paragraph containing three images that won't load, one with alt="one"
, one with a null alt
value ""
, and one without an alt
attribute, and a third paragraph containing three valid images with the same alt
values.
A null case example
This is to determine how a given browser "normally" treats the images, when they are not part of a figure
, for comparison with the figure examples.
figure
: figcaption
as the first childA figure
has a figcaption
as the first child, a second paragraph containing three images that won't load, one with alt="one"
, one with a null alt
value ""
, and one without an alt
attribute, then a third paragraph containing three valid images with the same alt
values.
Browsers should give "a compliant example" as the textual alternative for the figure.
figure
: figcaption
as the last childA figure
has a paragraph containing three images that won't load, one with alt="one"
, one with a null alt
value ""
, and one without an alt
attribute, a second paragraph containing three valid images with the same alt
values, and a figcaption
as the last child.
Browsers should provide "Another compliant example" as the textual alternative for the entire figure
.
figcaption
between two imagesThis example is invalid markup according to HTML5
A figure
has a paragraph containing three images that won't load, one with alt="one"
, one with a null alt
value ""
, and one without an alt
attribute, a figcaption
as the middle child element, then a third paragraph containing three valid images with the same alt
values as before.
Browsers should provide "A rebellious example" as an alternative for the figure, but code checkers should report an error
figcaption
between two imagesThis example is invalid markup according to HTML5
A figure
has a paragraph containing three images that won't load, one with alt="one"
, one with a null alt
value ""
, and one without an alt
attribute, then a figcaption
containing the text "A more rebellious example" as the second child, a figcaption
containing the text "Increased lack of respect" as the third child, and finally a second paragraph containing three valid images, with the same set of alt
values as before.
Browsers should provide "A rebellious example" - without recognising the second figcaption
as an alternative for the figure, but code checkers should report an error because the figcaption
s are not first or last, and because there are two of them.
figcaption
elements, first and last as per HTML 5This example is invalid markup according to HTML5
A figure
has a figcaption
containing the text "This could be great", a paragraph containing three images that won't load, one with alt="one"
, one with a null alt
value ""
, and one without an alt
attribute, as the second child, a second paragraph containing three valid images, with the same set of alt
values as before as the third child, and finally a figcaption
containing the text "Right place, wrong time".
Browsers should provide "This should be great" - without recognising the second figcaption
as an alternative for the figure. Code checkers should report an error because there are two figcaption
s.