Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' into selectmenu

  • Loading branch information...
commit 672218bfecacba0d7ed7b1120de07130756f65fb 2 parents a53916b + cf1470d
Kris Borchers kborchers authored

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. +15 0 ui/jquery.ui.menu.js
15 ui/jquery.ui.menu.js
@@ -294,6 +294,21 @@ $.widget( "ui.menu", {
294 294 focus: function( event, item ) {
295 295 this.blur( event );
296 296
  297 + if ( this._hasScroll() ) {
  298 + var borderTop = parseFloat( $.curCSS( this.activeMenu[0], "borderTopWidth", true ) ) || 0,
  299 + paddingTop = parseFloat( $.curCSS( this.activeMenu[0], "paddingTop", true ) ) || 0,
  300 + offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop,
  301 + scroll = this.activeMenu.scrollTop(),
  302 + elementHeight = this.activeMenu.height(),
  303 + itemHeight = item.height();
  304 +
  305 + if ( offset < 0 ) {
  306 + this.activeMenu.scrollTop( scroll + offset );
  307 + } else if ( offset + itemHeight > elementHeight ) {
  308 + this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
  309 + }
  310 + }
  311 +
297 312 this.active = item.first()
298 313 .children( "a" )
299 314 .addClass( "ui-state-focus" )

1 comment on commit 672218b

Kris Borchers
Owner

@fnagel OK, try this now. Sorry about that.

Please sign in to comment.
Something went wrong with that request. Please try again.