Skip to main content

Search and Top Navigation

#9178 closed bug (fixed)

Opened March 23, 2013 07:13AM UTC

Closed July 24, 2014 09:05PM UTC

Menu item click causes page scroll

Reported by: tooparam Owned by: tooparam
Priority: minor Milestone: 1.11.0
Component: ui.menu Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:
Description

Whenever I choose an item in the menu, it causes whole page scroll.

Attachments (0)
Change History (7)

Changed March 23, 2013 10:48AM UTC by tj.vantoll comment:1

owner: → tooparam
status: newpending

Hi tooparam,

Thanks for taking the time to contribute to the jQuery UI project. In order to assess this ticket we need a reduced test case that shows the issue. You can use this as a starting point http://jsfiddle.net/tj_vantoll/jCTEP/.

Thanks.

Changed March 24, 2013 06:54AM UTC by tooparam comment:2

status: pendingnew

here is the example test case

http://jsfiddle.net/jCTEP/3/

Changed March 24, 2013 07:38PM UTC by tj.vantoll comment:3

Ok I see this. This is fixed easily enough be adding a

 preventDefault() 
call but I'm guessing there might be some focus related reason we're not doing that here (https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.menu.js#L66)... so I'll wait for others to chime in.

If you need a workaround just add an event handler that prevents the default action: http://jsfiddle.net/tj_vantoll/FT5K9/.

Changed April 27, 2013 01:29PM UTC by tj.vantoll comment:4

scott.gonzalez / kborchers

We had chatted about his one in IRC awhile ago (http://irc.jquery.org/%23jqueryui-dev/%23jqueryui-dev_20130325.log.html) but I don't know if we ever came to a consensus over what we wanted to do here. Thoughts?

Changed April 29, 2013 04:15PM UTC by scottgonzalez comment:5

My thought is that we should stop using anchors and just let the main element be the focusable content. I don't remember why anchors were used.

Changed April 29, 2013 04:47PM UTC by tj.vantoll comment:6

status: newopen

Replying to [comment:5 scott.gonzalez]:

My thought is that we should stop using anchors and just let the main element be the focusable content. I don't remember why anchors were used.

Seems reasonable. I'm going to mark this as valid because I do think the described behavior is a bug.

Changed July 24, 2014 09:05PM UTC by scottgonzalez comment:7

milestone: none1.11.0
resolution: → fixed
status: openclosed

Anchors are no longer used as of 1.11.0. See #10130.