Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 70e2aed

Browse files
Navbar: Changed active state logic. Fixes #5707
Removed workaround for #1181. Fixed that issue by addressing the actual cause: event.target returns ui-btn-inner instead of the anchor
1 parent 5320abe commit 70e2aed

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

js/widgets/navbar.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,12 @@ $.widget( "mobile.navbar", $.mobile.widget, {
3838
});
3939

4040
$navbar.delegate( "a", "vclick", function( event ) {
41-
if ( !$(event.target).hasClass( "ui-disabled" ) ) {
41+
// ui-btn-inner is returned as target
42+
var target = $( event.target ).is( "a" ) ? $( this ) : $( this ).parent( "a" );
43+
44+
if ( !target.is( ".ui-disabled, .ui-btn-active" ) ) {
4245
$navbtns.removeClass( $.mobile.activeBtnClass );
43-
$( this ).addClass( $.mobile.activeBtnClass );
44-
// The code below is a workaround to fix #1181. We have to see why removeActiveLinkClass() doesn't take care of it.
45-
var activeNavbtn = $( this );
46-
$( document ).one( "pagechange", function( event ) {
47-
activeNavbtn.removeClass( $.mobile.activeBtnClass );
48-
});
46+
target.addClass( $.mobile.activeBtnClass );
4947
}
5048
});
5149

0 commit comments

Comments
 (0)