Moodle

javascript focus is annoying / disruptive

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.1.1
  • Fix Version/s: None
  • Component/s: General
  • Labels:
    None
  • Environment:
    All
  • Affected Branches:
    MOODLE_11_STABLE

Description

There is a setfocus javascript function that sets the focus to certain things when a page is loaded. Quite often this is annoying because many browsers remember where on the page you were when you hit the back button. Say I have scrolled 3/4 the way down a long page... and I click a link to look at a resource/assignment/etc. Then when I click the back button on my browser, I expect to go back to the previous page 3/4 of the way down. This is standard on most modern browsers. Because of the javascript focus command, however I go back all the way to the top of the page.

There may be multiple places where this occurs and is annoying, but one place that particularly bugs me is from the /course/view.php page. The setfocus goes to nearly the top of the page to the search forums form. I feel that the primary use of the view.php page is not to search the forums, so the handy setfocus does more harm than it does good.

Fix:

remove search.search

from this line:

print_header($courseword: $course->fullname, $course->fullname, $course->shortname, search.search, , true,

update_course_icon($course->id), $loggedinas);

in view.php.

Activity

Hide
Martin Dougiamas added a comment -

From Martin Dougiamas (martin at moodle.com) Thursday, 9 October 2003, 08:43 PM:

Yes, I agree. On that page, anyway. Fixed in CVS.

Show
Martin Dougiamas added a comment - From Martin Dougiamas (martin at moodle.com) Thursday, 9 October 2003, 08:43 PM: Yes, I agree. On that page, anyway. Fixed in CVS.
Hide
Michael Blake added a comment -

assign to a valid user

Show
Michael Blake added a comment - assign to a valid user
Hide
Olli Savolainen added a comment -

Is this the reason even the pages with login fields no longer have focus onload?

See also: an enhancement that does not disable the backspace that is assigned to the back button of some browsers:
http://www.whatstyle.net/articles/51/focus_onload_but_keep_backspace_intact

Show
Olli Savolainen added a comment - Is this the reason even the pages with login fields no longer have focus onload? See also: an enhancement that does not disable the backspace that is assigned to the back button of some browsers: http://www.whatstyle.net/articles/51/focus_onload_but_keep_backspace_intact
Hide
Olli Savolainen added a comment -

Just to jot this down for now, HTML5 appears to have taken this into account:

9. Allow users to disable autofocus: How many times have you started filling a form while the page was loading, only to be rudely forced onto another field after the page is loaded? The classic example is the user-password field. You begin to type your password, and the next moment, it is publicly displayed on the user field. Alternately, the user can specify which field should be auto-focused if they want the functionality.

http://www.techielife.com/10-reasons-why-html-5-will-change-the-web-and-1-why-it-wont/

Show
Olli Savolainen added a comment - Just to jot this down for now, HTML5 appears to have taken this into account: 9. Allow users to disable autofocus: How many times have you started filling a form while the page was loading, only to be rudely forced onto another field after the page is loaded? The classic example is the user-password field. You begin to type your password, and the next moment, it is publicly displayed on the user field. Alternately, the user can specify which field should be auto-focused if they want the functionality. http://www.techielife.com/10-reasons-why-html-5-will-change-the-web-and-1-why-it-wont/

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: