Opened 5 years ago

Closed 3 years ago

#9178 closed bug (fixed)

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.

Change History (7)

comment:1 Changed 5 years ago by tj.vantoll

Owner: set to 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.

comment:2 Changed 5 years ago by tooparam

Status: pendingnew

here is the example test case

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

comment:3 Changed 5 years ago by tj.vantoll

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/.

comment:4 Changed 5 years ago by tj.vantoll

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?

comment:5 Changed 5 years ago by Scott González

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.

comment:6 in reply to:  5 Changed 5 years ago by tj.vantoll

Status: newopen

Replying to 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.

comment:7 Changed 3 years ago by Scott González

Milestone: none1.11.0
Resolution: fixed
Status: openclosed

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

Note: See TracTickets for help on using tickets.