File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -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" )
You can’t perform that action at this time.
0 commit comments