WCAG 2.1 requires that all non-text content have a text alternative. This includes images, charts, and graphs, which must be accompanied by a description that conveys the same information as the visual content.
To ensure accessibility, it's essential to provide alternative text for images, which can be done using the alt attribute in HTML. For example, an image of a logo can have an alt attribute with the text "Company Logo".
The purpose of alternative text is to provide context and meaning to users who cannot see the image. For instance, an image of a chart can have an alt attribute with a brief description of the data it represents.
WCAG 2.1 also requires that all interactive elements, such as buttons and links, be accessible. This can be achieved by providing a clear and consistent naming convention for these elements.
For your interest: Itext Insert Image in Header File from Html
WCAG Text Requirements
WCAG Text Requirements are designed to ensure that text is easily readable by everyone, including those with visual impairments.
The minimum font size for normal text is 12 points, with a minimum line height of 1.5 times the font size.
Headings should be presented in a way that is consistent with the visual style of the rest of the text.
A different take: Edit Image Size Html
Bold and Italic
Bold and Italic text can be used to emphasize a word or passage, but it's not recommended. This is because screen readers don't normally announce these tags to the user.
Some screen readers, like JAWS, can be configured to point out bold and italics, but even then, it's not a reliable way to convey emphasis.
The and tags should be avoided if you want to make text stand out.
Curious to learn more? Check out: Coding Tags for Html
Applicability
This technique relates to three Success Criteria: 1.1.1 (Non-text Content), 2.4.4 (Link Purpose (In Context)), and 2.4.9 (Link Purpose (Link Only)).
The applicability of this technique depends on the markup-based technologies being used. If they can override text to meet the specified metrics, then this Success Criterion is applicable.
For instance, Cascading Style Sheet/HTML technologies can allow for the specified spacing metrics. However, plugin technologies would need to have a built-in ability to modify styles to the specified metrics.
Currently, this Success Criterion does not apply to PDF as it is not implemented using markup.
Expand your knowledge: How to Make 2 Columns in Html
WCAG Image Requirements
Images on a website should have a short text alternative with the alt attribute, which is referred to as "alt text". The alt text should convey the same meaning as the image, not describe its visual characteristics.
For input elements of type 'image', the alt attribute is used to provide a functional label, indicating the button's function, especially if there are multiple submit buttons on the page. This is crucial for accessibility.
Here are the key points to check for images:
- Each image element should contain an alt attribute.
- If the image contains words that are important to understanding the content, the words should be included in the alt text.
- The alt text should convey the same meaning as the image, not describe its visual characteristics.
Images used as submit buttons, like those with a type attribute value of "image", should have an alt attribute that indicates the button's function.
Combining Adjacent Image Links
When combining adjacent image links, it's essential to consider the alt text for each image. The alt text should provide a clear and concise description of the image.
The WCAG recommends using a single alt attribute for adjacent image links, as long as the links are related and the images are not essential to understanding the content.
For example, if you have two images that are side by side, like a map and a photo of a landmark, you can combine the alt text into a single attribute.
Additional reading: Html Wrap Text around Image
H24: Image Map Alternatives
If you're creating HTML documents with image maps, you'll want to ensure they're accessible to everyone.
HTML 4.01 supports client-side image maps, which are a great way to provide interactive maps on your website.
To specify alt text for area elements in HTML 4.01, you can use the alt attribute.
For example, if you have an image map with several areas, you can provide a brief description of each area using the alt attribute.
Here are some examples of how to specify alt text for area elements in HTML 4.01:
- HTML 4.01 - client-side image maps
- HTML 4.01 - how to specify alt text
Remember to always provide alt text for area elements to ensure your image maps are accessible to everyone.
H28: Abbreviation Definitions
The abbr element is a crucial tool for providing definitions for abbreviations, and it's essential to use it correctly to ensure accessibility. The abbr element should be used for any abbreviation, including acronyms and initialisms.
In HTML 4 and XHTML, initialisms and acronyms were marked up using the acronym element, but in HTML5 and newer versions of HTML, the acronym element was marked as obsolete in favor of the more general abbr element.
To use the abbr element effectively, provide expansions or definitions for abbreviations by using the abbr element, as seen in technique H28: Providing definitions for abbreviations by using the abbr element.
Here are some key points to keep in mind when using the abbr element:
- The abbr element should be used for any abbreviation, including acronyms and initialisms.
- In HTML 5 and newer versions of HTML, the acronym element was marked as obsolete in favor of the more general abbr element.
- The abbr element should provide expansions or definitions for abbreviations.
By following these guidelines, you can ensure that your content is accessible and usable for everyone.
H37: Alt Attributes
Providing a text alternative that identifies the purpose of the non-text content is crucial for accessibility. The alt attribute is used to provide a short text alternative for images.
To ensure that the alt attribute is used correctly, check that each img element which conveys meaning contains an alt attribute. This attribute should be used to label the image and provide a functional description of the image.
If the image contains words that are important to understanding the content, the words should be included in the text alternative. This is especially important for images that are interactive, such as image maps.
See what others are reading: Html Image Alternative Text
The alt attribute should not attempt to describe the visual characteristics of the image itself, but rather convey the same meaning as the image.
Here are some examples of how to use the alt attribute correctly:
- For an image that provides a link to a free newsletter, the alt text could be "Free newsletter. Get free recipes, news, and more. Learn more."
- For an image that depicts the floor plan of a building, the alt text could be "The building's floor plan. Select a room for more information about the purpose or content of the room."
These examples illustrate how the alt attribute can be used to provide a functional description of the image and convey the same meaning as the image.
WCAG Form Requirements
WCAG 2.1 requires that form controls be associated with text labels to ensure accessibility. This is achieved by using the label element to explicitly associate a form control with a label, where the value of the for attribute must be the same as the value of the id attribute of the form control.
For form controls like input, select, and textarea, the label element must be visible to assist users who need help understanding the purpose of the field, as per Success Criterion 3.3.2. However, for Success Criteria 1.1.1, 1.3.1, and 4.1.2, the label element can be hidden using CSS.
The label element is not used for Submit and Reset buttons, Image buttons, Hidden input fields, and Script buttons, as their labels are provided via the value attribute, alt attribute, or element content itself.
Recommended read: How to Hide a Text in Html
H36: Alt Attributes on Submit Buttons
H36: Alt Attributes on Submit Buttons is a crucial aspect of making your forms accessible to everyone. This technique is specifically designed for image-based submit buttons.
For input elements of type 'image', the alt attribute of the input element is used to provide a functional label. This label indicates the button's function, but does not attempt to describe the image.
The alt attribute should be used only on image submit buttons, as user agent support for this attribute on other types of form controls is not well defined. Other mechanisms are used to label these controls.
An input element with an alt attribute should have a label that indicates the button's function. This label is especially important if there are multiple submit buttons on the page that each lead to different results.
Here's a quick checklist to ensure you're using alt attributes correctly:
- For all input elements that have a type attribute value of "image", check for the presence of an alt attribute.
- Check that the alt attribute indicates the button's function.
By following this simple technique, you'll be making your forms more accessible and user-friendly for everyone.
H44: Labeling Form Controls
Labeling form controls is a crucial aspect of making your website accessible. A label element explicitly associates a form control with a text label, making it easier for users to understand the purpose of the control.
The label element must have the same value as the id attribute of the form control, and the id attribute must be unique in the Web page. This is sufficient for Success Criteria 1.1.1, 1.3.1, and 4.1.2, even if the label element is hidden using CSS.
A label is positioned after input elements of type="checkbox" and type="radio". Note that the label element is not used for Submit and Reset buttons, Image buttons, Hidden input fields, or Script buttons.
For all input elements of type text, file, or password, for all textareas, and for all select elements, check that there is a label element that identifies the purpose of the control before the input, textarea, or select element. The for attribute of the label element must match the id of the input, textarea, or select element, and the label element must be visible.
Here are the elements that use explicitly associated labels:
- input type="text"
- input type="checkbox"
- input type="radio"
- input type="file"
- input type="password"
- textarea
- select
By using the label element, you can provide a larger clickable area for the control, making it easier for users with impaired motor control to interact with your form.
WCAG List Requirements
To create semantically correct lists, use the dl element to provide a description of names or terms. This ensures that terms and their descriptions are semantically related even as presentation format changes.
The dl element should contain a dt element for each term, followed by a dd element for its description. If multiple terms share the same description, the dt elements should immediately follow each other.
For example, a list of descriptions of nautical terms used on a website about sailing could be marked up as follows:
- HTML5 Description lists
- HTML 4 Definition lists: the DL, DT, and DD elements
Here are the key steps to check if a list is correctly marked up:
- Check that the list is contained within a dl element.
- Check that each term in the list being described is contained within a dt element.
- Check that when there is more than one term that shares the same description, the dt elements immediately follow each other.
- Check that the description for each term is contained in one or more dd elements.
- Check that the one or more dd elements immediately follow the one or more dt elements containing the term being described.
H48: Ol, Ul and Dl for Lists or Groups of Links
Using ol, ul, and dl elements for lists is crucial for accessibility. The ol element is used for ordered lists, the ul element for unordered lists, and the dl element for definition lists.
Lists can be visually formatted, but if the markup doesn't indicate the list relationship, users may have difficulty navigating the information. Assistive technologies can help users navigate lists, and style sheets can change the presentation while preserving the list's integrity.
The list structure is useful for grouping hyperlinks, helping screen reader users navigate from the first item to the end of the list or jump to the next list. This helps them bypass groups of links if they choose to.
Some examples of related techniques include using caption elements to associate data table captions with data tables (H39), using id and headers attributes to associate data cells with header cells in data tables (H43), and using the scope attribute to associate header cells and data cells in data tables (H63).
Discover more: Basic Html How to Read Json of Data
Table Markup for Tabular Information
Using table markup to present tabular information is crucial for preserving relationships within the information, even when users can't see the table or the presentation format is changed.
Tabular information is represented in two dimensions, with logical relationships among text, numbers, images, or other data existing in columns and rows. These relationships are recognizable in columns and rows, allowing users to perceive the logical connections.
A different take: Table Html Syntax
Using the table element with child elements tr, th, and td makes these relationships perceivable. This is in contrast to techniques like inserting tabs to create columns or using the pre element, which are purely visual and lose the logical relationships if the user can't see the table or the visual presentation is changed.
Simple tables usually have only one level of headers for columns and/or one level of headers on the rows. Typically, row 1 column 1 is either blank or describes the contents of the entire column 1.
Row 1 columns are not blank and describe the contents of the entire column, allowing the reader to distinguish the difference in meaning between that column and other columns. Column 1 rows are usually not blank and contain "row headings" that describe the contents of the entire row.
Here are some relevant HTML elements for creating table markup:
- HTML 4.01 Table Element
- HTML 4.01 Table rows: The TR element
- HTML 4.01 Table cells: The TH and TD elements
WCAG Headings and Structure
WCAG Headings and Structure are crucial for creating a well-organized and accessible web page. Headings should be used in a hierarchical layout, with h3 as a subsection of h2, which is a subsection of h1.
The objective of using headings is to convey the structure of the content, allowing users to navigate a page by sections or skip repeated blocks of information. This is especially important for users with disabilities, who can use assistive technology to jump directly to the appropriate heading and begin reading the content.
To achieve this, headings should be used to indicate the start of main content, mark up section headings within the main content area, and demarcate different navigational sections. This can be done by nesting headings hierarchically, with the most important information given the highest logical level, and subsections given subsequent logical levels.
Recommended read: Creating Simple Html to Extract Information from Xml File
Hierarchical Heading Organization
Hierarchical heading organization is a crucial aspect of WCAG guidelines. Headings are used in a hierarchical layout with h3 as a subsection of h2, which is a subsection of h1.
This layout is essential for users with assistive technology, as it allows them to jump directly to the appropriate heading and begin reading the content. Skipping levels in the sequence of headings can create the impression that the structure of the document has not been properly thought through.
Headings are designed to convey logical hierarchy, and nesting them hierarchically will help users understand the overall organization of the content more easily. The most important information is given the highest logical level, and subsections are given subsequent logical levels.
Here are some key points to keep in mind when organizing headings hierarchically:
- Use h1 as the main heading for the page.
- Use h2 as a subsection of h1.
- Use h3 as a subsection of h2.
- And so on.
By following this structure, you can create a clear and logical hierarchy of headings that will help users navigate your content more easily.
Enhancing User Experience
Implementing 'aria-required' and 'required' attributes properly can significantly enhance the user experience by providing clear, accessibility-friendly forms that cater to a wide audience.
These attributes inform users about mandatory fields, reducing errors and streamlining form submission processes.
By using 'aria-required' and 'required' attributes, you can create forms that are both user-friendly and accessible, making it easier for everyone to complete and submit them.
This is especially important for websites and applications that cater to a diverse audience, as it ensures that all users can navigate and interact with the site or app without barriers.
Here's an interesting read: Required Compute Acceleration Vinod Vaikuntanathan
WCAG Accessibility Attributes
WCAG (Web Content Accessibility Guidelines) attributes are used to make web content more accessible to people with disabilities. The HTML 'alt' attribute is used to provide a short text alternative for images, which is referred to as "alt text".
To ensure accessibility, each 'img' element should contain an 'alt' attribute. The value of this attribute should convey the same meaning as the image, not just describe its visual characteristics. For example, if an image contains the text "Free newsletter. Get free recipes, news, and more. Learn more", the alt text should match this text.
The 'aria-required' attribute is used to indicate to assistive technologies that user input is required on a form element. It informs users that a field needs to be filled out, but does not prevent form submission. This attribute should be used in conjunction with HTML validation if the form control lacks native HTML5 support.
Here are the key differences between the HTML 'required' attribute and the ARIA 'aria-required' attribute:
Implementing both attributes can enhance the user experience by providing clear, accessibility-friendly forms that cater to a wide audience.
WCAG Best Practices and Testing
To ensure forms are accessible to all users, it's essential to implement both the HTML 'required' attribute and ARIA 'aria-required' attribute. This allows for native browser validation and communication of mandatory fields to assistive technologies.
Developers need to validate their use of these attributes to confirm they serve their respective purposes effectively. Testing the implementation of both required and aria-required attributes is crucial to ensure forms behave as expected when interacting with various assistive technologies and browsers.
Careful testing and validation of both required and aria-required attributes help maintain robust, accessible forms. To ensure accessibility, developers should test the following:
- Screen Readers: Ensure assistive technologies like screen readers can detect and communicate required fields to users.
- Form Submission: Verify that forms with required fields can't be submitted if the field is empty.
- Visual Indicators: Check that visual indicators, such as asterisks or color changes, are used consistently to indicate required fields.
- HTML5 Validation: Test that HTML5 validation is triggered when a required field is empty.
- Interaction With Assistive Technologies: Verify that assistive technologies can interact with forms correctly, including detecting and communicating required fields.
- Compatibility Across Browsers: Test that forms behave consistently across different browsers and devices.
Related Tests
Careful testing and validation of required and aria-required attributes are crucial for maintaining robust, accessible forms.
To verify that forms behave as expected, developers should test their implementation with various assistive technologies and browsers.
Screen readers, form submission, visual indicators, HTML5 validation, interaction with assistive technologies, and compatibility across browsers are all important aspects to test.
Here are some specific tests to consider:
- Screen Readers: Test how the form is read by screen readers.
- Form Submission: Verify that the form submits correctly when all required fields are filled.
- Visual Indicators: Check that the form displays visual indicators for required fields.
- HTML5 Validation: Test that the form validates correctly using HTML5.
- Interaction With Assistive Technologies: Verify that the form interacts correctly with assistive technologies.
- Compatibility Across Browsers: Test the form's compatibility across different browsers.
- Accessibility Best Practices: Check that the form adheres to accessibility best practices.
These tests help ensure that the form is not only syntactically correct but also functionally effective.
Validation and Testing
To ensure that forms are accessible to all users, it's crucial to test the implementation of both required and aria-required attributes thoroughly. This involves verifying that forms behave as expected when interacting with various assistive technologies and browsers.
Developers should check that forms with these attributes are properly validated by assistive technologies, such as screen readers. This includes testing form submission, visual indicators, HTML5 validation, interaction with assistive technologies, and compatibility across browsers.
Careful testing and validation of both required and aria-required attributes help maintain robust, accessible forms. It's the developer's responsibility to ensure these attributes are not only syntactically correct but functionally effective, creating a seamless experience for all users.
Here are some key areas to test:
- Screen Readers: Ensure that assistive technologies can read the form fields and indicate which ones are required.
- Form Submission: Verify that the form submits correctly when all required fields are filled in.
- Visual Indicators: Check that visual indicators, such as asterisks or color changes, are used to indicate required fields.
- HTML5 Validation: Test that HTML5 validation is triggered when required fields are empty.
- Interaction With Assistive Technologies: Ensure that assistive technologies can interact with the form fields and indicate errors or warnings.
- Compatibility Across Browsers: Test that the form works correctly across different browsers and devices.
Cross-Browser Compatibility
Cross-Browser Compatibility is crucial for ensuring that your website is accessible to all users. It's not uncommon for users to visit your site using different browsers and devices, so you want to make sure your website looks and functions great across the board.
Intriguing read: Free Website Themes Html Css
The 'aria-required' attribute may vary in support by different screen readers and might not be announced in all browsers. This means you need to thoroughly test your website across various combinations of browsers and assistive technologies to ensure proper functionality.
On the other hand, the 'required' attribute is widely supported by modern browsers and automatically prompts the user if the field is left empty. This is a big plus, as it aids in user recognition of mandatory fields and makes the user experience more seamless.
Here's a quick rundown of the two attributes:
Both attributes are essential for an inclusive web design that caters to all users' needs. By understanding their strengths and limitations, you can create a more user-friendly and accessible website.
Frequently Asked Questions
What are the WCAG guidelines for typography?
The WCAG guidelines recommend a 4.5:1 contrast ratio for normal text up to 24px, and a 3:1 ratio for bold text of 19px or larger and regular text of 24px or larger. Use online tools to evaluate your website's typography and ensure accessibility.
What are the WCAG 2.0 AA contrast requirements for normal text?
For WCAG 2.0 AA compliance, normal text requires a contrast ratio of at least 4.5:1. This ensures readability for users with visual impairments.
Sources
- https://help.siteimprove.com/support/solutions/articles/80000448460-accessibility-the-use-of-emphasis-in-text
- https://www.w3.org/TR/WCAG20-TECHS/html
- https://www.w3.org/WAI/WCAG21/Understanding/text-spacing.html
- https://accessiblyapp.com/blog/aria-required-html-required/
- https://www.w3.org/WAI/WCAG21/Understanding/resize-text.html
Featured Images: pexels.com