EPUB Accessibility Metadata

This metadata as outlined in the 1.1 Accessibility Specification Conformance and Discoverability can be found in the EPUB Package Document

EPUB Accessibility Metadata Examples

EPUB accessibility metadata describing an EPUB

Here is an example of accessibility metadata embedded within the OPF file, which will be used as a reference point for the following examples on EPUB accessibility metadata: the results of the XPath shown are based on this example.

EPUB accessibility metadata describing an audiobook

Here is an example of an accessibility OPF Metadata for describing an audiobook, which will be used as a reference point for the following examples on EPUB accessibility metadata: the results of the XPath shown are based on this example.

Conventions for implementations

The code conventions used in the provided code snippet follow a structure commonly found in programming languages like Python, Java, or C++. Here's an explanation of the conventions:

Conditionals and Control Flow:
IF, ELSE IF, and ELSE (in bold and capital letters) statements are used to define different conditions and the corresponding actions to be taken.
Operators:
Written operators (is present) are used to check if a particular code or codelist is present (or not) in the metadata record.
Logical operators:
Logical operators (AND, OR, NOT, in bold and capital letters) are used to combine conditions.
String Literals:
String literals are used to represent the text that should be displayed when a particular condition is met.
Variable Naming:
The terms like "property" and "value" are used in a way that suggests a variable or data structure representing the metadata record.
Indentation:
The code uses consistent indentation to define blocks of code within conditional statements. This is crucial for readability and maintaining a clear structure.
Readability:
The code is written in a way that is intended to be easily readable and understandable even by non-coders.

Common Functions

In this section we define the functions common to all techniques, which are called by them during execution.

Pre Processing

Before working directly with the metadata we must read the metadata in the Package document (OPF file) inside the EPUB. This is a common starting point for all techniques that allows us to query the metadata directly.

This algorithm takes the package_document_as_text argument: a UTF-8 string representing the Package document.

To generate the internal representation, run the following steps:

  1. LET package_document_content be textual representation of the Package document for the publication given package_document_as_text.
  2. LET package_document be the DOM tree that results from parsing package_document_content using an XML DOM parser.
  3. Return package_document.

Check for Node

Many of the techniques rely on checking for the presence or absence of metadata in the metadata section of the Package document.

This algorithm takes:

To check for node, run the following steps:

  1. IF package_document contains path: THEN return True.
  2. ELSE return False.

Techniques

Visual adjustments

This technique relates to Visual adjustments key information.

This algorithm takes the package_document_as_text argument: a UTF-8 string representing the Package document.

Understanding the variables

all_textual_content_can_be_modified

If true it indicates that the accessibilityFeature="displayTransformability" (All textual content can be modified) is present in the OPF file, otherwise if false it means that the metadata is not present.

All textual content can be modified means that the digital publication does not restrict the ability of users to modify and reflow the display of any textual content to the full extent allowed by the reading system (i.e. to change the text size or typeface, line height and word spacing, colors).

is_fixed_layout

If true it indicates that the layout="pre-paginated" (Fixed format) is present in the OPF file, otherwise if false it means that the metadata is not present.

Fixed format means that digital publication is in fixed format (e.g. EPUB Fixed Layout).

Variables setup

  1. LET package_document be the result of calling pre processing given package_document_as_text.
  2. LET all_textual_content_can_be_modified be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="displayTransformability"].
  3. LET is_fixed_layout be the result of calling check for node on package_document, /package/metadata/meta[@property="rendition:layout" and text()="pre-paginated"].

Instructions

  1. IF all_textual_content_can_be_modified: THEN display "Appearance can be modified".
  2. ELSE IF is_fixed_layout: THEN display "Appearance cannot be modified".
  3. ELSE display "Appearance modifiability not known".

Supports nonvisual reading

This technique relates to Supports nonvisual reading key information.

This algorithm takes the package_document_as_text argument: a UTF-8 string representing the Package document.

Understanding the variables

all_necessary_content_textual

If true it indicates that the accessModeSufficient="textual" (all main content is provided in textual form) is present in the OPF file, otherwise if false it means that the metadata is not present.

All non-decorative content supports reading without sight means that all contents of the digital publication necessary to use and understanding, including text, images (via their alternative descriptions), audio and video material (via their transcripts, descriptions, captions or subtitles) are fully accessible via suitable reading devices, for example text-to-speech screen readers or tactile reading devices (‘Braille displays’), and nothing in the digital publication prevents or blocks the use of alternative reading modes. The entire publication can be navigated and ‘read’ using only text rendered via sound or touch, and does not require visual perception.

non_textual_content_images

If true it indicates that at least one of the following is present in the OPF file:

  • accessMode="chartOnVisual" (Charts and Graphs);
  • accessMode="chemOnVisual" (Chemistry);
  • accessMode="diagramOnVisual" (Diagrams);
  • accessMode="mathOnVisual" (Math);
  • accessMode="musicOnVisual" (Music);
  • accessMode="textOnVisual" (Images of text);
  • otherwise if false it means that this metadata is not present.

This means that the content contains images of any type.

textual_alternative_images

If true it indicates that at least one of the following is present in the OPF file:

  • accessibilityFeature="alternativeText" (Short alternative textual descriptions);
  • accessibilityFeature="longDescription" (Full alternative textual descriptions);
  • accessibilityFeature="describedMath" (Visual of math fully described));
  • otherwise if false it means that this metadata is not present.

This means that there are textual alternatives for images.

Variables setup

  1. LET package_document be the result of calling pre processing given package_document_as_text.
  2. LET all_necessary_content_textual be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessModeSufficient" and text()="textual"].
  3. LET non_textual_content_images be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and
    (text()="chartOnVisual" or text()="chemOnVisual" or
    text()="diagramOnVisual" or text()="mathOnVisual" or
    text()="musicOnVisual" or text()="textOnVisual")]
    .
  4. LET textual_alternative_images be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and
    (text()="longDescription" or text()="alternativeText" or text()="describedMath")]
    .

Instructions

  1. IF all_necessary_content_textual: THEN display "Readable in read aloud and braille".
  2. ELSE IF non_textual_content_images AND NOT textual_alternative_images: THEN display "Not fully readable in read aloud and braille".
  3. ELSE display "May not be fully readable in read aloud and braille".

Conformance

This technique relates to Conformance key information.

Pre-recorded audio

This technique relates to Pre-recorded audio key information.

This algorithm takes the package_document_as_text argument: a UTF-8 string representing the Package document.

Understanding the variables

all_content_audio

If true it indicates that the accessModeSufficient="auditory" (all main content is provided in audio form) is present in the OPF file, otherwise if false it means that the metadata is not present.

synchronised_pre_recorded_audio

If true it indicates that the accessibilityFeature="sychronizedAudioText" is present in the OPF file, otherwise, if false, it means that the metadata is not present.

This indicates that text-synchronised pre-recorded audio narration (natural or synthesised voice) is included for substantially all textual matter, including all alternative descriptions, e.g. via a SMIL media overlay.

audio_content

If true it indicates that the accessMode="auditory" is present in the OPF file, otherwise, if false, it means that the metadata is not present.

This indicates that pre-recorded audio content is included as part of the work.

Variables setup

  1. LET package_document be the result of calling pre processing given package_document_as_text.
  2. LET all_content_audio be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessModeSufficient" and text()="auditory"].
  3. LET synchronised_pre_recorded_audio be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="sychronizedAudioText"].
  4. LET audio_content be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessMode" and text()="auditory"].

Instructions

  1. IF all_content_audio: THEN display "Audio only".
  2. ELSE IF synchronised_pre_recorded_audio: THEN display "Synchronized audio and text".
  3. ELSE IF audio_content: THEN display "Complementary audio and text".
  4. ELSE display "No information about pre-recorded audio".

    This key information can be hidden if metadata is missing.

Charts, diagrams, and formulas

This technique relates to Charts, diagrams, and formulas key information.

This algorithm takes the package_document_as_text argument: a UTF-8 string representing the Package document.

Understanding the variables

contains_charts_diagrams

If true it indicates that the accessibilityFeature="chartOnVisual" (charts encoded in visual form) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication that the product has some information conveyed via some form of illustration, such as a graph, a chart, a diagram, a figure, etc).

long_text_descriptions

If true it indicates that the accessibilityFeature="longDescriptions" (Full alternative textual description) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication that a full alternative textual description has been supplied for all of the graphs, charts, diagrams, or figures necessary to understand the content.

contains_chemical_formula

If true it indicates that the accessibilityFeature="chemOnVisual" (Chemical content) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication that the publication contains chemical notations, formulae.

chemical_formula_as_chemml

If true it indicates that the accessibilityFeature="ChemML" (Accessible chemistry content as ChemML) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication that the chemical formulae are presented using ChemML and works with compatible assistive technology.

contains_math_formula

If true it indicates that the accessibilityFeature="describedMath" (Mathematical content) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication that the publication contains mathematical notation, equations, formulae.

math_formula_as_latex

If true it indicates that the accessibilityFeature="latex" (Accessible math content as LaTeX) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication that the chemical formulae are presented using LaTeX and works with compatible assistive technology.

math_formula_as_mathml

If true it indicates that the accessibilityFeature="MathML" (Accessible math content as MathML) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication that all mathematical content is presented using MathML and works with compatible assistive technology.

Variables setup

  1. LET package_document be the result of calling pre processing given package_document_as_text.
  2. LET contains_charts_diagrams be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="chartOnVisual"].
  3. LET long_text_descriptions be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="longDescriptions"].
  4. LET contains_chemical_formula be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="chemOnVisual"].
  5. LET chemical_formula_as_chemml be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="ChemML"].
  6. LET contains_math_formula be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="describedMath"].
  7. LET math_formula_as_latex be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="latex"].
  8. LET math_formula_as_mathml be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityFeature" and text()="MathML"].

Instructions

  1. IF (contains_charts_diagrams AND long_text_descriptions): THEN display "Charts and diagrams have extended descriptions".
  2. IF chemical_formula_as_chemml: THEN display "Accessible chemistry content".
  3. IF math_formula_as_latex OR math_formula_as_mathml: THEN display "Accessible math content".
  4. IF (contains_charts_diagrams OR contains_chemical_formula OR contains_math_formula) AND NOT (long_text_descriptions OR chemical_formula_as_chemml OR math_formula_as_latex OR math_formula_as_mathml): THEN display "Accessibility of formulas, charts, and diagrams unknown".

Hazards

This technique relates to Hazards key information.

This algorithm takes the package_document_as_text argument: a UTF-8 string representing the Package document.

Understanding the variables

no_hazards_or_warnings_confirmed

If true it indicates that the accessibilityHazard="none" (no accessibility hazards) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means there is a positive indication in the accessiblity metadata within the EPUB confirming there are no associated hazard warnings with this product.

flashing_hazard

If true it indicates that the accessibilityHazard="flashing" (WARNING - Flashing hazards) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication in the accessiblity metadata within the EPUB confirming that the product has a flashing hazard which must be displayed.

no_flashing_hazards

If true it indicates that the accessibilityHazard="noFlashingHazard" (No flashing hazard warning necessary) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means there is a positive indication in the accessiblity metadata within the EPUB confirming there are no flashing hazards associated with this product.

motion_simulation_hazard

If true it indicates that the accessibilityHazard="motionSimulation" (WARNING - Motion simulation hazard) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication in the accessiblity metadata within the EPUB confirming that the product has a motion simulation hazard which must be displayed.

no_motion_hazards

If true it indicates that the accessibilityHazard="noMotionSimulationHazard" (No motion simulation hazard warning necessary) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means there is a positive indication in the accessiblity metadata within the EPUB confirming there are no motion simulation hazards associated with this product.

sound_hazard

If true it indicates that the accessibilityHazard="Sound" (WARNING - Sound hazard) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that there is a positive indication in the accessiblity metadata within the EPUB confirming that the product has a sound hazard which must be displayed.

no_sound_hazards

If true it indicates that the accessibilityHazard="noSoundHazard" (No sound hazard warning necessary) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means there is a positive indication in the accessiblity metadata within the EPUB confirming there are no sound hazards associated with this product.

unknown_if_contains_hazards

If true it indicates that the accessibilityHazard="unknown" (unknown hazards) is present in the OPF file, otherwise if false it means that the metadata is not present.

This means that the product has not been assessed for hazards and there is no information about potential hazards.

Variables setup

  1. LET package_document be the result of calling pre processing given package_document_as_text.
  2. LET no_hazards_or_warnings_confirmed be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="none"].
  3. LET flashing_hazard be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="flashing"].
  4. LET no_flashing_hazards be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="noFlashingHazard"].
  5. LET motion_simulation_hazard be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="motionSimulation"].
  6. LET no_motion_hazards be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="noMotionSimulation"].
  7. LET sound_hazard be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="sound"].
  8. LET no_sound_hazards be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="noSoundHazard"].
  9. LET unknown_if_contains_hazards be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilityHazard" and text()="unknown"].

Instructions

  1. IF no_hazards_or_warnings_confirmed OR (no_flashing_hazards AND no_motion_hazards AND no_sound_hazards): THEN display "No hazards".
  2. ELSE IF flashing_hazard OR motion_simulation_hazard OR sound_hazard: THEN LET hazards be an empty array.
    1. IF flashing_hazard: THEN APPEND "flashing" to hazards.
    2. IF motion_simulation_hazard: THEN APPEND "motion" to hazards.
    3. IF sound_hazard: THEN APPEND "sound" to hazards.
    4. LET hazards_string be the result of:
      • calling join on hazards with the separator ", "
      • making uppercase the first character
      • replacing the last occurence of ", " with " and "
      • concatenating " hazards" to the end of the string IF (length of hazards) > 1 ELSE concatenating " hazard" to the end of the string.
    5. display hazards_string.
  3. ELSE IF unknown_if_contains_hazards: THEN display "The presence of hazards is unknown".
  4. ELSE display "No information about possible hazards".

    This key information can be hidden if metadata is missing.

Accessibility summary

This technique relates to Accessibility summary key information.

This algorithm takes the package_document_as_text argument: a UTF-8 string representing the Package document.

Being human-written, the accessibility summary will appear in the original language of the publication. Therefore it is necessary to take care of setting up the correct language tag information.

Accessibility summaries were necessary when no systems exposed computed accessibility metadata. With more systems now displaying this information, much of the accessibility summary may be redundant. Publishers should focus on adding information not provided within the computed metadata, such as specifying where in a video file a flashing hazard exists, or noting the reason why they failed to meet WCAG-AA due to color contrast issues in the Appendix.

Understanding the variables

accessibility_summary

If true it indicates that the accessibilitySummary is present in the OPF file, otherwise if false it means that the metadata is not present.

This means there is a human-written text containing a short explanatory summary of the accessibility of the product or the URL of a web page comprising such a summary. Summarizes the already existent information and may add information that the publisher could not express with the other codes.

lang_attribute_accessibility_summary

Returns the lang attribute of the node containing the accessibility_summary, or the lang attribute of the nearest anchestor.

This is the language code in which the text of the Accessibility summary was written.

language_of_text

Returns the value of nearest "language" (Language of content) if present in the OPF File, otherwise if false it means that the metadata is not present.

This indicates the main language of the content and therefore the most probable language of accessibility summary.

Variables setup

  1. LET package_document be the result of calling pre processing given package_document_as_text.
  2. LET accessibility_summary be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilitySummary"].
  3. LET lang_attribute_accessibility_summary be the result of calling check for node on package_document, /package/metadata/meta[@property="schema:accessibilitySummary"]/(@lang|ancestor::*/@lang)[last()].
  4. LET language_of_text be the result of calling check for node on package_document, /package/metadata/dc:language[1]/text().

Instructions

  1. IF lang_attribute_accessibility_summary is NOT empty: THEN LET language_accessibility_summary be the value of lang_attribute_accessibility_summary.
  2. ELSE LET language_accessibility_summary be the value of language_of_text.
  3. ELSE IF accessibility_summary is NOT empty: THEN display the content of accessibility_summary with language_accessibility_summary as language.
  4. ELSE display "No accessibility summary".

    This key information can be hidden if metadata is missing.

Additional accessibility information

This technique relates to Additional accessibility information key information.

Acknowledgements

Contributors

Reviewers