Moodle
  1. Moodle
  2. MDL-39029

Auto focus the cursor directly into quiz password box

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 2.5
    • Component/s: Quiz
    • Labels:
    • Testing Instructions:
      Hide

      1.Log in as teacher and create a quiz having password.
      2.Log in as student and access the quiz that was made i step-1.
      3.Quiz will ask for password and cursor would be auto-focused on password text-box.

      Show
      1.Log in as teacher and create a quiz having password. 2.Log in as student and access the quiz that was made i step-1. 3.Quiz will ask for password and cursor would be auto-focused on password text-box.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      49145

      Description

      When a student clicks on a quiz that has a password the

      EXPECTED:
      The page loads and the cursor blinks inside the "password area". Student enters the password and hits enter to begin quiz

      ACTUAL:
      The page loads and the cursor does not focus on the "password area". Student must click into the "password area" and then enter it.

        Issue Links

          Activity

          Hide
          Tim Hunt added a comment -

          That might you your expectation, but then I guess you do not use a screen-reader. Have a read of http://www.brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/ and http://stackoverflow.com/questions/2180645/is-automatically-assigning-focus-bad-for-accessibility.

          Therefore, it is not clear to me that we should do this.

          Show
          Tim Hunt added a comment - That might you your expectation, but then I guess you do not use a screen-reader. Have a read of http://www.brucelawson.co.uk/2009/the-accessibility-of-html-5-autofocus/ and http://stackoverflow.com/questions/2180645/is-automatically-assigning-focus-bad-for-accessibility . Therefore, it is not clear to me that we should do this.
          Hide
          Nathan Hammond added a comment -

          I read the postings on the link you provided. While I have no experience with ScreenReaders, there seems to be no conflict from the comments I read about possible issues. There is only one field on the entire page (the one for entering the password) so there would be no confusion (nothing not intuitive or unexpected going on there). The screen would not scroll down to any unusual place (which was one of the other comments made there). Just my 2 cents.

          Show
          Nathan Hammond added a comment - I read the postings on the link you provided. While I have no experience with ScreenReaders, there seems to be no conflict from the comments I read about possible issues. There is only one field on the entire page (the one for entering the password) so there would be no confusion (nothing not intuitive or unexpected going on there). The screen would not scroll down to any unusual place (which was one of the other comments made there). Just my 2 cents.
          Hide
          Jayesh Anandani added a comment -

          Thanks to Tim for showing simple way!

          Show
          Jayesh Anandani added a comment - Thanks to Tim for showing simple way!
          Hide
          Tim Hunt added a comment -

          Review comments:

          1. The commit comment does not mention the tracker issue id. See http://docs.moodle.org/dev/Commit_cheat_sheet#Provide_clear_commit_messages for the preferred format for commit messages.

          2. The code could be better. $attributes= is meaningless. I would prefer to use the structured form array('autofocus' => 'true') rather than the string form.

          3. https://moodle.org/plugins/view.php?plugin=local_codechecker is your friend.

          Show
          Tim Hunt added a comment - Review comments: 1. The commit comment does not mention the tracker issue id. See http://docs.moodle.org/dev/Commit_cheat_sheet#Provide_clear_commit_messages for the preferred format for commit messages. 2. The code could be better. $attributes= is meaningless. I would prefer to use the structured form array('autofocus' => 'true') rather than the string form. 3. https://moodle.org/plugins/view.php?plugin=local_codechecker is your friend.
          Hide
          Jayesh Anandani added a comment - - edited

          I would make the changes and submit again!

          Show
          Jayesh Anandani added a comment - - edited I would make the changes and submit again!
          Hide
          Jayesh Anandani added a comment -

          Changes made as per suggestion!

          Show
          Jayesh Anandani added a comment - Changes made as per suggestion!
          Hide
          Tim Hunt added a comment -

          1. The code is now almost perfect, but not quite. According to the Moodle coding style (http://docs.moodle.org/dev/Coding_style) there must be a space after the comma (,). Yes, we are really picky about these things. That is why we made the codechecker plugin.

          2. See the comment I made about commit messages in the other bug.

          Show
          Tim Hunt added a comment - 1. The code is now almost perfect, but not quite. According to the Moodle coding style ( http://docs.moodle.org/dev/Coding_style ) there must be a space after the comma (,). Yes, we are really picky about these things. That is why we made the codechecker plugin. 2. See the comment I made about commit messages in the other bug.
          Hide
          Jayesh Anandani added a comment -

          1. Space added!

          2. Commit message short!

          Show
          Jayesh Anandani added a comment - 1. Space added! 2. Commit message short!
          Hide
          Tim Hunt added a comment -

          Good. We are very nearly there.

          I am wondering if it would be clearer to say:

          MDL-39029 quiz password: autofocus feature added

          What do you think?

          Show
          Tim Hunt added a comment - Good. We are very nearly there. I am wondering if it would be clearer to say: MDL-39029 quiz password: autofocus feature added What do you think?
          Hide
          Jayesh Anandani added a comment -

          Yeah Would be much better!

          Show
          Jayesh Anandani added a comment - Yeah Would be much better!
          Hide
          Jayesh Anandani added a comment -

          Done with it!

          Show
          Jayesh Anandani added a comment - Done with it!
          Hide
          Tim Hunt added a comment -

          Would you like to write some testing instructions?

          Show
          Tim Hunt added a comment - Would you like to write some testing instructions?
          Hide
          Jayesh Anandani added a comment -

          Yes would definetly like to do so!

          Show
          Jayesh Anandani added a comment - Yes would definetly like to do so!
          Hide
          Tim Hunt added a comment -

          Thanks Jayesh. Submitting for integration.

          Show
          Tim Hunt added a comment - Thanks Jayesh. Submitting for integration.
          Hide
          Dan Poltawski added a comment -

          Integrated to master - thanks Jayesh!

          Show
          Dan Poltawski added a comment - Integrated to master - thanks Jayesh!
          Hide
          Rajesh Taneja added a comment -

          Thanks for fixing this Jayesh,

          Works as mentioned in test instructions.

          FYI:
          Getting setType warning on startattempt page.

          Did you remember to call setType() for 'cmid'? Defaulting to PARAM_RAW cleaning.•line 1289 of /lib/formslib.php: call to debugging()
          •line 281 of /lib/formslib.php: call to moodleform->detectMissingSetType()
          •line 202 of /lib/formslib.php: call to moodleform->_process_submission()
          •line 338 of /mod/quiz/accessmanager.php: call to moodleform->moodleform()
          •line 134 of /mod/quiz/startattempt.php: call to quiz_access_manager->get_preflight_check_form()
          

          @Tim let me know if you want me to create an issue for this. Can't find in MDL-34311

          Show
          Rajesh Taneja added a comment - Thanks for fixing this Jayesh, Works as mentioned in test instructions. FYI: Getting setType warning on startattempt page. Did you remember to call setType() for 'cmid'? Defaulting to PARAM_RAW cleaning.•line 1289 of /lib/formslib.php: call to debugging() •line 281 of /lib/formslib.php: call to moodleform->detectMissingSetType() •line 202 of /lib/formslib.php: call to moodleform->_process_submission() •line 338 of /mod/quiz/accessmanager.php: call to moodleform->moodleform() •line 134 of /mod/quiz/startattempt.php: call to quiz_access_manager->get_preflight_check_form() @Tim let me know if you want me to create an issue for this. Can't find in MDL-34311
          Hide
          Tim Hunt added a comment -

          Rajesh, new tracker issue for that please.

          Show
          Tim Hunt added a comment - Rajesh, new tracker issue for that please.
          Hide
          Rajesh Taneja added a comment -

          Thanks Tim,

          Created MDL-39186.

          Show
          Rajesh Taneja added a comment - Thanks Tim, Created MDL-39186 .
          Hide
          Dan Poltawski added a comment -

          Blooming Marvelous! It's time for a knees up - your changes are upstream!

          Thanks for making Moodle better!

          Toodle pip

          Show
          Dan Poltawski added a comment - Blooming Marvelous! It's time for a knees up - your changes are upstream! Thanks for making Moodle better! Toodle pip

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: