Test Keyboard Navigation in Complex Oracle JET Components

Introduction

This will be our first look at the Departments tab in the ACCLearningPath app. The review process outlined in the previous learning path in this accessibility series is followed to identify any accessibility issues.

Objectives

In this tutorial, you will learn how to identify and fix the accessibility issues in the Departments tab of the ACCLearningPath app.

Prerequisites

Task 1: Review the Page Structure

  1. In your terminal window, navigate to the ACCLearningPath folder and run the app.

    $ ojet serve
    

    The app in the browser will open to the Introduction page with the Overview tab loaded.

  2. Click on the Departments tab in the tab bar and assess the page structure. The Departments page consists of three panels, where each panel displays department data using various Oracle JET components.

    Departments Tab Before

    Description of the illustration departments_tab_before.png

  3. Navigate to the ACCLearningPath/src/js/views folder and open the departments.html file in a code editor.

  4. Locate the main <div> tag in the file.

    <div class="oj-hybrid-padding">
       <div id="mainContainer" class="oj-flex" style="width:100%;">
    
  5. Insert an h3 heading between the two <div> tags to identify the Departments page.

    <div class="oj-hybrid-padding">
       <h3>Departments</h3>
       <div id="mainContainer" class="oj-flex" style="width:100%;">
    
  6. Locate the <div> tag that defines the middle panel that contains a filmstrip.

    <div class="oj-flex-item fs-container">
       <oj-film-strip id="deptFilmstrip" max-items-per-page="1"
          . . . >
    
  7. Insert an h4 heading between the opening <div> and <oj-filmstrip> tags to identify the panel and provide a visible label for the filmstrip.

    <div class="oj-flex-item fs-container">
       <h4>Departments Film Strip</h4>
       <oj-film-strip id=“deptFilmstrip” max-items-per-page=“1”
          . . . >
    
  8. Locate the <div> tag that forms the left panel that contains a data grid.

    <div class="oj-flex-item">
       <oj-data-grid id="datagrid"
          style="width:100%; min-width:400px; height:200px; margin-bottom:5px"
          . . . >
    
  9. Insert an h4 heading between the <div> and <oj-data-grid> tags to identify the panel and provide a visible label for the data grid.

    <div class="oj-flex-item">
       <h4>Departments Data Grid</h4>
       <oj-data-grid id="datagrid"
          style="width:100%; min-width:400px; height:200px; margin-bottom:5px"
          . . . >
    
  10. Locate the opening <div> tag that forms the third panel that contains a chart.

    <div class="oj-flex-item oj-sm-margin-4x-horizontal">
       <oj-chart id="pieChart" type="bar" data="[[chartDataProvider]]" animation-on-display="auto" animation-on-data-change="auto"
          . . . >
    
  11. Insert an h4 heading between the opening <div> and <oj-chart> tags. This heading identifies the panel and serves as a visual label for the chart.

    <div class="oj-flex-item oj-sm-margin-4x-horizontal">
       <h4>Salaries by Department</h4>
       <oj-chart id="pieChart"
          type="bar"
          data="[[chartDataProvider]]"
          animation-on-display="auto"
          animation-on-data-change="auto"
          . . . >
    
  12. Save the file. In the browser, verify the changes to your app’s Departments tab.

    Departments Tab After

    Description of the illustration departments_tab_after.png

Task 2: Perform a Keyboard-Only Test

The second part of the accessibility review is to perform a keyboard-only test of the app’s Departments tab.

  1. Press <Ctrl+L> to set focus on the address bar.

  2. Press <Tab>. Focus moves to the skip nav link.

  3. Press <Tab>. Focus moves to john.hancock@oracle.com in the user menu at the top-right of the page.

  4. Press <Tab>. Focus moves to Introduction in the navigation menu immediately below the user menu.

  5. Press <Tab>. Focus moves to Overview in the tab bar.

  6. Press <Tab>. Focus moves to Accounting in the filmstrip.

  7. Press <right arrow> to move to the next entry, Research, in the filmstrip.

  8. Press <left arrow> to move back to Accounting in the filmstrip.

  9. Press <right arrow> three times. Focus moves to the last entry in the filmstrip, Operations.

  10. Press <Tab>. Focus moves to the first databody cell in the data grid, under the Id column. The value of the focused cell is 10.

  11. Press <right arrow>. Focus moves to Accounting under the second column of the data grid, Name.

  12. Press <right arrow>. Focus moves to New York in the final column of the data grid, Location.

    Notice that the focus outline appears around the cell that contains the city name.

  13. Press <F2>. The focus outline tightens to surround only the text New York in the cell.

    According to the <oj-data-grid> element’s keyboard documentation, use <F2> to make the contents of the cell actionable. The <F2> function key lets you initiate actions supported by the active component. In this case, the cell contains a link to Google Maps that you will activate.

  14. Press <Enter> to activate the New York link. A new browser window opens to a Google Maps page of New York.

  15. Press <Ctrl+F4> to close the Google Maps window.

  16. Press <Esc>. The focus outline widens to surround the cell that contains New York in the third column.

    According to the <oj-data-grid> element’s keyboard documentation, use <Esc> to exit actionable mode so that you can continue navigating to other components.

  17. Press <Tab>. Focus moves to the first bar in the bar chart.

Task 3: Perform a Screen-Reader Validation

The final piece of the accessibility review is the screen-reader validation. The following validation steps are based on using the JAWS screen reader, but the results will be similar if you are using the NVDA screen reader.

  1. In the terminal window, exit the running app by pressing <Ctrl+C>, and, if prompted, enter y.

  2. Start your screen reader and then restart your web app.

    $ ojet serve
    

    Your app will open in your browser automatically; the screen reader will start reading once the page is fully loaded.

  3. Click on the Departments tab in the tab bar. Do not use the mouse after this point.

  4. Press <Ctrl+L> to set focus to the address bar.

  5. Press <Tab>. JAWS reads, “Skip to main content. Same page link.”

  6. Press <Tab>. JAWS says, “Banner region. Toolbar. john.hancock@oracle.com button menu. Press space to activate the menu, then navigate with arrow keys.”

  7. Press <Tab>. JAWS says, “Navigation region tab. Introduction tab selected. 1 of 2.”

  8. Press <Tab>. JAWS says, “Main region tab. Departments tab selected. 4 of 4.”

  9. Press <Tab> to move focus to the film strip. JAWS says, “Accounting. New York. 3 employees. Displaying page 1 of 4.”

  10. Press <Tab> to move focus to the data grid. JAWS says, “This is a data grid with 4 rows and 3 columns. Id. Name. Location.” After reading the column headers, the screen reader reads the databody cells of the table from left to right. Then it reads the current focus, “Row 1. Column 1. Id: 10.”

  11. Press <right arrow>. JAWS says, “Column 2. Name: Accounting.”

  12. Press <right arrow>. JAWS says, “Column 3. Location: New York. Contains controls. You have reached the last column.”

  13. Press <Tab>. JAWS says, “Data visualization: chart. Graphic. Series: Accounting; Group: Department; Value: USD 3,750.00. Graphic.”

    Notice that as focus moves among the panels, JAWS gives no indication of the panel headings. There is also no way to scroll the filmstrip from page to page.

  14. Open the departments.html file in your code editor.

    • Success Criterion 4.1.2 Name, Role, Value requires that each of the components in the three panels has a label associated with it. The level-4 headings serve as visible labels.
    • Success Criterion 2.5.3 Label in Name requires that the entire text of the heading be included in the label. The aria-label attributes added in the following steps 18 through 23 will incorporate the heading text for the panel.
  15. Locate the opening <oj-film-strip> tag and add an aria-label attribute.

    <oj-film-strip id="deptFilmstrip"
       max-items-per-page="1"
       aria-label="Departments Film Strip - Use the paging controls in the next region to change pages."
       arrow-visibility="hidden"
       class="demo-stretch-items"
       . . . >
    
  16. Locate the opening <oj-data-grid> tag and add an aria-label attribute.

    <oj-data-grid id="datagrid"
       style="width:100%; min-width: 400px; height:200px;margin-bottom:5px"
       aria-label="Departments Data Grid -- Press enter on the city name to open a google map of the city."
       data="[[dgDataProvider]]"
       header.column.style="[[getCellWidth]]"
       . . . >
    
  17. Locate the opening <oj-chart> tag and add an aria-label attribute.

    <oj-chart id="pieChart"
       type="bar"
       aria-label="Salaries by Department bar chart"
       data="[[chartDataProvider]]"
       animation-on-display="auto"
       animation-on-data-change="auto"
       . . . >
    

    The final change involves the pagination controls for the filmstrip in the middle panel.

  18. Locate the closing </oj-film-strip> and </oj-bind-if> tags.

          </oj-film-strip>
       </div>
    </div>
    </oj-bind-if>
    
  19. Add the pagination control and surrounding div elements between the closing </div> and </oj-bind-if> tags.

          </oj-film-strip>
       </div>
    </div>
    <div class="oj-flex oj-sm-flex-items-initial oj-sm-justify-content-center">
       <div class="oj-flex-item">
          <div style="text-align: center;">
          <div style="display: inline-block;margin-top: 4px;">
             <oj-paging-control id="pagingControl"
                aria-controls="deptFilmstrip"
                data="[[pagingModel]]"
                page-size="0"
                page-options='{"type": "dots"}'>
             </oj-paging-control>
          </div>
          </div>
       </div>
    </div>
    </oj-bind-if>
    
  20. Save the file. Your file should look similar to departments-html.txt.

  21. Rerun the screen-reader validation. Ensure that the labels are spoken for the filmstrip, data grid, and chart and that the pagination controls are present underneath the filmstrip.

You have completed the final tutorial in the app accessibility series of learning paths.

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.