The screen reader is able to audibly read the content, but does not navigate or highlight it

I'm currently working on a react-redux e-commerce application and I'm facing an issue with the screen reader functionality. I'm having trouble getting the screen reader to navigate from the payment section to the order summary component and read the content within it.

When I click on the order summary contents, which is displayed in a table with an h4 header, the screen reader does read it. However, I am unable to tab to it from the payment section.

The code snippet for the OrderSummary.js file is as follows:

<h2 className="title h3">Order Summary</h2>
              <table className="subtotal-wrapper body-color">
                <caption className="screen-reader-text">Order Summary</caption>
                <tbody>
                  <tr>
                    <th>Subtotal:</th>
                    <td>${formatPrice(this.props.orderSummary.originalSubtotal)}</td>
                  </tr>
                  {showShippingCost(this.props.orderSummary.totalShippingCost, this.props.orderSummary.totalShippingDiscount)}
                  <tr>
                    <th>Est Sales Tax:</th>
                    <td>${formatPrice(this.props.orderSummary.totalEstimatedTax)}</td>
                  </tr>
                  {getOptionalComponent('Total Savings:', this.props.orderSummary.discountedSubtotal)}
                </tbody>
              </table>

Instead of navigating from the form in the `Address.js` component like it should,

<form className="marketing-offer" onSubmit={doNothing} >
              <Checkbox
                name="marketingOptIn"
                checked={!!this.props.marketingOptIn}
                onChange={this.props.handleMarketingOptInChange}
              >
                <span className="payment-option special-offers">Yes! I would like to receive updates, special offers, and other information from shopDisney and The Walt Disney Family of Companies.</span>
              </Checkbox>
            </form>

the screen reader jumps straight to the "Continue to Review" button in the order summary section without reading the table in `OrderSummary.js`.

While I can manually trigger the reading by clicking on it, the tabbing behavior from the checkbox in the form field to the `OrderSummary.js` table is not working as expected.

Any suggestions on how to resolve this issue?

Answer №1

To ensure proper tab order, simply assign a tabindex="0" to the desired elements. The attribute "tabindex="0"" will establish the sequence of elements in the tab order according to their position in the source code. By default, only interactive elements are included in the tab order as explained here: interactive content.

It is important to note that it is not advisable to include non-interactive elements in the tab order. Learn more about this recommendation at: Accessibility concerns with tabindex

Answer №2

To enable tabbing through specific HTML elements, consider assigning tabindex="1", tabindex="2", and so on to each element.

Answer №3

Opting for a tabindex of 0 as opposed to a positive number is solid advice, although @CodyS cautions against including non-interactive elements in the tab order towards the end of his post.

If you're worried that a screen reader user might struggle to locate or read a table on your page, fret not if your page is well-structured. By "well-organized", I mean sections should be logically grouped with relevant <nav>, <section>, and other document structure elements, appropriate use of headings (<h1>, <h2>, etc), and properly formatted tables (<th scope="col">). This approach enables a screen reader user to utilize special navigation keys to easily locate these elements and grasp an overview of your page layout.

Speaking of tables, ensure you have clearly defined column headers (<th scope="col">) and row headers (<th scope="row">). While column headers are usually prioritized, row headers play a crucial role when navigating a table using a screen reader. Without a row header, a user may hear the cell value without understanding its context. The first column can serve as the row header, even if it only contains values. For instance:

<table>
  <tr>
    <th scope="col">Name</th>
    <th scope="col">Age</th>
    <th scope="col">Favorite Color</th>
  </tr>
  <tr>
    <th scope="row">Jane</th>
    <td>35</td>
    <td>Red</td>
  </tr>
  <tr>
    <th scope="row">Mary</th>
    <td>36</td>
    <td>Blue</td>
  </tr>
  <tr>
    <th scope="row">Cindy</th>
    <td>37</td>
    <td>Green</td>
  </tr>
</table>

With my screen reader focus on 35, moving down one cell would prompt me to hear "Mary 36" instead of just "36," providing clarity on whom 36 belongs to.

In terms of transitioning from the "payment" section to the "order summary" section, having designated <section> elements allows screen reader users to navigate through different sections effortlessly using ARIA landmarks.

<section aria-label="payment options">
  ...
</section>
<section aria-label="summary of order">
  ...
</section>

The aria-label will be vocalized by the screen reader but won't be visible on the screen.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What methods can be used to obfuscate my JavaScript code within the developer console?

Currently looking for a method to hide my JavaScript code from being visible in the browser's developer console while maintaining its functionality. Alternatively, I would like to restrict it to run only on a particular website. Grateful for any insig ...

Exploring Time Scaling and Range Adjustment in D3 Barcharts

My dataset looks something like this: dateRange = [ { date: 2017-03-23, value: 10 }, { date: 2017-03-25, value: 15 }, { date: 2017-04-01, value: 13 }, { date: 2017-04-02, value: 19 } ]; The results can be viewed here: https://embed.plnkr.co/iOBAuCZmo ...

What is the best way to receive style prop recommendations for a reusable component using React Native and TypeScript?

I have developed a reusable text component with the following code: import React, {FC, ReactNode} from 'react'; import {StyleSheet, Text as RNText} from 'react-native'; interface TextProps { style?: any; children: ReactNode | React ...

Node.js variable displays in the console but fails to appear in the view

Here is the code snippet: module.exports = { index: function (req, res, next) { //get an array of all users in user collection Notification.find(function foundNotification(err, notifications) { if (err) return next(err); var elusua ...

Having trouble with drawImage function in HTML5 Canvas on Firefox?

This script is successfully running on Chrome, Opera, Yandex, and IE browsers, but it encounters an issue when trying to run on Firefox. In the code, "el" refers to my image (which is stored like this <img src="background.png"). fadeInEffect: function ...

What is the best way to decompress gzcompress from PHP in JavaScript?

Currently, I am in the process of creating both an android app and a website that pulls information from a php script. The data is compressed using gzcompress($dat, 9); within the php script. While I have managed to decompress the data in the android app, ...

Connecting a JavaScript variable

Is it possible to include a JavaScript variable in a link? I've tried the code below but it just shows a blank page. The viewData.php file will contain PHP GET Variables used to retrieve data based on the period and type, which determine whether renta ...

Getting PHP Post data into a jQuery ajax request can be achieved by using the `$_POST

I'm struggling to figure out how to pass the blog title into the data field of my ajax call. I've been searching for beginner tutorials on SQL, PHP, and AJAX, but haven't found anything that clarifies this issue. If anyone knows of any usefu ...

Ensuring the Presence of Component Props in Styled Components

I have a dilemma with a component that accepts a prop to render another component. Here is the setup: const IconBase = styled.div` // CSS Styles Here `; const Icon = props => ( <IconBase> <props.name /> </IconBase> ); This ...

Stopping a Bootstrap Modal Closure When Validation Errors are Present

I'm dealing with a bootstrap model within a .NET MVC5 app. Although my client-side validation is functioning properly (using jquery unobtrusive in MVC), I have encountered an issue where the modal keeps closing even when there are errors present. How ...

Error: Namespace declaration does not have a type annotation - TypeScript/Babel

After creating my app using the command npx create-react-app --typescript, I encountered an issue with generated code and namespaces causing Babel to throw an error. Here are the steps I took to try and resolve the issue: I ejected the project Updated b ...

Tips for validating the values in a multi-value dictionary against each key in node.js?

I have a dictionary with multiple values and I need to check if any of those values are equal to the respective URL while iterating through the loop. console.log("Hello World") const dns =require('dns') //Verifying the status of the URL fun ...

Tracking NWJS progress bar while executing lengthy loop in JavaScript

I'm currently facing some challenges with JavaScript as I attempt to create a desktop application using NW.JS. The issue arises when I drag and drop a .xml file into my app, triggering a function that reads the XML, performs certain tasks, and saves a ...

The slider components have an endless loop feature that only runs once before coming to a

I'm working on creating an infinite slider that loops continuously without the need for navigation buttons. Instead, I plan to allow users to control the slider using touch gestures (although this functionality is not yet implemented in the code snipp ...

Unable to execute function with input parameter as a string

I have a piece of code that is supposed to display an album on my webpage. When I use the function in this manner: <?php for ($key_Number = 0; $key_Number < count($album); $key_Number++) { echo '<a href="#" onclick="return false" ...

How can I create grey rectangular hover effects like those seen in Office 365?

I found a fiddle http://jsfiddle.net/HEue6/1/ that seems like a good starting point, but I want to make it look and feel more like Office 365. I believe the font used in Office 365 is Segoe UI Semilight, but there are also mentions of the Google font Ralew ...

Issue with MIME handling while utilizing Vue-Router in combination with Express

Struggling to access a specific route in Express, I keep encountering an error in my browser. Additionally, when the Vue application is built, only the Home page and the 404 page seem to work properly, while the rest display a default empty HTML layout. F ...

Filtering for Material Autocomplete is limited to the getOptionLabel field

Currently, I am utilizing the Google Material-UI autocomplete component. It is currently only filtering based on the "getOptionLabel" option field when text is entered into the input field. However, I would like the autocomplete to filter based on more tha ...

Form submission in Firefox experiences a delay due to the 'Storage' function

Below is a simple submit button that submits a form: <!DOCTYPE html> <html> <head> </head> <body> <form action="action" method="POST> <button type="submit">Submit</button> </form> ...

Accessing Public Photos from Facebook Users

Is it possible to create a web app that can retrieve all public photos from any user's Facebook account using their profile URL? For instance, some Facebook profiles allow non-logged in users to view profile pictures and cover photos. I am developing ...