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

Refactor check for new window target to detect a "new window" lang string

    XMLWordPrintable

Details

    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • MDL-75404-311_toolbrickfieldlinkinnewwindow
    • MDL-75404-400_toolbrickfieldlinkinnewwindow
    • MDL-75404-master_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

      Test

      1. Go to the Accessibility 102 course.
      2. Navigate to your Accessibility report for the Accessibility 102 course, from the course administration menu.
      3. Click on the "Submit to Analyse" button to request that the course is analysed by the accessibility toolkit.
      4. 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.)
      5. 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>".
      6. Update the tool_brickfield code with the patch.
      7. 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).
      8. Run cron again.
      9. Navigate to your Accessibility report for the Accessibility 102 course again.
      10. 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.)
      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 Test 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>". 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.)

    Description

      It's been decided to make a small change to the checks for links which have a blank target, thus opening in a new window, as discussed in the Moodle forums.

      The minor change is to allow (i.e. not report as an error) a blank target link / area if they have included the phrase "new window" in their link text or area alt text.

      This phrase processing is multilingual aware. It will also do a readability check, to prevent spaces being used in the lang string instead, which would otherwise neutralise this check completely. 

      Testing:

      Before, the HTML "<a href="www.google.com" target="_blank">This is google (opens in new window)</a>" will be flagged as an error for the check "Links opening into a new window should warn users in advance". After patch is applied, this HTML will pass this check.

      Attachments

        Activity

          People

            wuzi1999 Karen Holland
            wuzi1999 Karen Holland
            Mike Churchward, Karen Holland
            Votes:
            7 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: