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

Move (non-JS): title attribute is on wrong tag

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.5.3
    • 2.6.5, 2.7.2
    • Course
    • MOODLE_25_STABLE
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • MDL-42909-master
    • Hide
      • Turn off JS in your browser
      • Enabled editing in a course
      • Move an item
      • Check the source code of the move-target (the dotted box)
      • The link should now have the title "Move 'sdaf' to this location"
      Show
      Turn off JS in your browser Enabled editing in a course Move an item Check the source code of the move-target (the dotted box) The link should now have the title "Move 'sdaf' to this location"
    • 5
    • FRONTEND Sprint 13

    Description

      When you are moving items (using the non-AJAX version), the move targets are written out using code like the following:

      <li class="first movehere" title="Move 'AA306 discussion' to this location">
      <a href="https://learn2acct.open.ac.uk/course/mod.php?movetosection=149146&sesskey=666">
      <img class="movetarget" src="https://learn2acct.open.ac.uk/theme/image.php/ou/core/1383320278/movehere" title="Move to here" alt="Move to here">
      </a>
      </li>
      

      As you can see, there is a title attribute on the LI tag which does not make a lot of sense. It should be on the link tag. (Additionally, there is an unnecessary title attribute on the img tag.)

      This was caused by MDL-37085.

      The previous code was:

      <a title="Move 'AA306 discussion' to this location" href="https://learn2.open.ac.uk/course/mod.php?moveto=287791&amp;sesskey=666"><img class="movetarget" src="https://learn2.open.ac.uk/theme/image.php/ou/core/1382685195/movehere" alt="Move to here"></a>
      

      This code is correct, with a title attribute on the A tag containing the full text, and an alt attribute (no title) on the IMG tag.

      For accessibility reasons, none of these titles are suitable anyway. All links should have different texts so while the longer text includes the name of the item being moved, that doesn't actually help as it's still the same for all of them. An accessible solution would use text like:

      'Move item to Week 4 before "Study resources"'

      In other words, I didn't describe the item being moved (because they probably know, and it's the same for all of them) but I included the section name of the target location and a relative before/after for the position within that section.

      I am not sure whether or not it is worth doing anything about this because I know Moodle HQ is planning to stop supporting the non-JS graceful degradation features. I was thinking about fixing the regression and putting it back to have the right attribute on the right tag, but since it's inaccessible even after doing that (and always was), I don't think I am going to bother...

      So probably just filing this bug and leave it for Moodle staff to decide what to do, sorry!

      The offending code where it puts the title on the li is course/renderer.php in course_section_cm_list, currently line 1097/1106, btw.

      Attachments

        Activity

          People

            phalacee Jason Fowler
            quen Sam Marshall
            Jetha Chan Jetha Chan
            Sam Hemelryk Sam Hemelryk
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8/Sep/14