Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-78338

Update "new window" accessibility check (backport of MDL-75404)

    XMLWordPrintable

Details

    • MOODLE_311_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-78338-401_toolbrickfieldlinkinnewwindow
    • MDL-78338-402_toolbrickfieldlinkinnewwindow
    • Hide

      Setup

      1. This test requires a publicly available site (e.g. via ngrok)
      2. Site registered in Brickfield with API key and secret. If you don't have a Brickfield account, you can register here.
      3. Activate your site with Brickfield in "Site administration / Plugins / Admin tools / Accessibility / Brickfield registration" by entering the API and Secret keys.
      4. Enable analysis requests in "Site administration / Plugins / Admin tools / Accessibility / Accessibility toolkit settings"
      5. Restore the 'Accessibility 102' course backup accessibility_102.mbz

      Notes

      These tests require you to switch between the 'before', and the 'after' code.
      To access the 'before' code, you can use the following git command:

      git checkout <BRANCH> # moodle.git
      

      To access the 'after' code, you can use the follow

      git checkout <BRANCH> # integration.git
      

      Test

      1. Ensure that you are using the before code.
      2. Go to the Accessibility 102 course.
      3. Navigate to your Accessibility report for the Accessibility 102 course, from the course administration menu.
      4. Click on the "Submit to Analyse" button to request that the course is analysed by the accessibility toolkit.
      5. Run cron. (You should edit the brickfield cron tasks at Site administration > Server > Tasks > Scheduled tasks to run every minute to speed up this analysis process so that the brickfield task is run the very next time you run cron.)
      6. Confirm that you can see the following error with Activity of "Assignment - Do you know where you're going to (or your links)?", Check of "Links opening into a new window should warn users in advance." and HTML code of "<a href="https://www.rte.ie/" target="_blank">this link open in a new window</a>".
      7. Switch to the after code.
      8. Update the tool_brickfield code with the patch.
      9. Make a small change, such as adding a space somewhere, to the Assignment - "Do you know where you're going to (or your links)?" Description field, so that the analysis is queued to be repeated. (in the Accessibility 102 course).
      10. Run cron again.
      11. Navigate to your Accessibility report for the Accessibility 102 course again.
        1. This time, the relevant error should NOT appear, as the text "new window" has been detected in the text of the link, so no error is reported anymore. (If there is still an error, just run cron again until you get no error.)

      Alternate test

      1. Ensure that you are using the before code.
      2. Copy the admin/tool/brickfield/tests/local/htmlchecker/common/checks/a_links_dont_open_new_window_test.php and admin/tool/brickfield/tests/local/htmlchecker/common/checks/area_dont_open_new_window_test.php modified unit tests from the patch links into the base Moodle install into the same directories.
      3. Run this unit tests. Verify they fail on the test for appropriate text.
      4. Install the patched version and rerun the same tests.
        1. Verify the tests that failed now pass.
      5. Switch to the after code.
      Show
      Setup This test requires a publicly available site (e.g. via ngrok) Site registered in Brickfield with API key and secret. If you don't have a Brickfield account, you can register here . Activate your site with Brickfield in "Site administration / Plugins / Admin tools / Accessibility / Brickfield registration" by entering the API and Secret keys. Enable analysis requests in "Site administration / Plugins / Admin tools / Accessibility / Accessibility toolkit settings" Restore the 'Accessibility 102' course backup accessibility_102.mbz Notes These tests require you to switch between the 'before', and the 'after' code. To access the 'before' code, you can use the following git command: git checkout <BRANCH> # moodle.git To access the 'after' code, you can use the follow git checkout <BRANCH> # integration.git Test Ensure that you are using the before code. Go to the Accessibility 102 course. Navigate to your Accessibility report for the Accessibility 102 course, from the course administration menu. Click on the "Submit to Analyse" button to request that the course is analysed by the accessibility toolkit. Run cron. (You should edit the brickfield cron tasks at Site administration > Server > Tasks > Scheduled tasks to run every minute to speed up this analysis process so that the brickfield task is run the very next time you run cron.) Confirm that you can see the following error with Activity of "Assignment - Do you know where you're going to (or your links)?", Check of "Links opening into a new window should warn users in advance." and HTML code of "<a href="https://www.rte.ie/" target="_blank">this link open in a new window</a>". Switch to the after code. Update the tool_brickfield code with the patch. Make a small change, such as adding a space somewhere, to the Assignment - "Do you know where you're going to (or your links)?" Description field, so that the analysis is queued to be repeated. (in the Accessibility 102 course). Run cron again. Navigate to your Accessibility report for the Accessibility 102 course again. This time, the relevant error should NOT appear, as the text "new window" has been detected in the text of the link, so no error is reported anymore. (If there is still an error, just run cron again until you get no error.) Alternate test Ensure that you are using the before code. Copy the admin/tool/brickfield/tests/local/htmlchecker/common/checks/a_links_dont_open_new_window_test.php and admin/tool/brickfield/tests/local/htmlchecker/common/checks/area_dont_open_new_window_test.php modified unit tests from the patch links into the base Moodle install into the same directories. Run this unit tests. Verify they fail on the test for appropriate text. Install the patched version and rerun the same tests. Verify the tests that failed now pass. Switch to the after code.

    Description

      I really hope that this issue is considered for backporting to earlier versions. Prior to this fix, the "link opening in a new window" accessibility check was not behaving as it was documented and intended to do analysis, and as WCAG itself advises and other accessibility advisors (search for Links opening..) say is best practice.

      The definition of the check says: "Links opening into a new window should warn users in advance." Without the fix implemented in MDL-75404, the check was flagging the content as an error even if there was an advance warning.

      This advance warning is most commonly done through adding a phrase such as "opens in new window" within the text of the link itself. This is what the new code was allowing the accessibility check to detect, and if detected, then an error was not present and didn't need to be reported.

      Attachments

        Issue Links

          Activity

            People

              mchurch Mike Churchward
              wuzi1999 Karen Holland
              Paul Holden Paul Holden
              Andrew Lyons Andrew Lyons
              Kim Jared Lucas Kim Jared Lucas
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 20 minutes
                  4h 20m

                  Clockify

                    Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.