Opened 11 years ago

Closed 9 years ago

#4549 closed bug (fixed)

Accordion and Tab causes multiple "active" tabs

Reported by: mwlang Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.tabs Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Using

  • jquery 1.3.2
  • ui 1.7.1

The Accordion is set up to change sections on mouseover and not on mouse click (but this doesn't seem to matter either way).

On a page, I have a tab control and an accordion control. Neither is a subset of the other.

If a user changes an accordion selection and then clicks a different tab. The tab that was formerly active retains the ui-state-focus class selector, thus causing that tab to appear to have the styling associated with having focus on it.

The problem manifests itself in Firefox 3.0.3. It does NOT manifest in Safari 4 nor IE 6.

Watching events fire in firebug shows that while hovering over sections in the accordion, the ui-state-focus class is NOT removed from the tab in the interim. When returning the mouse pointer to the tab control and clicking another tab (with and without entering the currently selected tab's space), both the newly selected tab and the formerly active tab are updated, but both tabs get the ui-state-focus selector added.

Change History (4)

comment:1 Changed 11 years ago by mwlang

The following demonstrates the issue at hand. I made the .ui-state-focus class background red to make it jump out.

<!DOCTYPE html>
<html>
<head>
	<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
	<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script>
	<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
	<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.accordion.js"></script>
	<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.tabs.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		var Accordion = $('#accordion').accordion({ 
			fillSpace: 	true
			, 	event: 		'mouseover' 
		});	
		var myTabs = $("#tabs").tabs();
		myTabs.bind('tabsselect', function(event, ui) {
			console.debug('tab selected');
		});
	});
	</script>

</head>
<body style="font-size:62.5%;">


	<div id="accordion">
		<h3><a href="#">Section 1</a></h3>
		<div>
			<p>
				Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
				ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
				amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
				odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
			</p>
		</div>
		<h3><a href="#">Section 2</a></h3>
		<div>
			<p>
				Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
				purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
				velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
				suscipit faucibus urna.
			</p>
		</div>
		<h3><a href="#">Section 3</a></h3>
		<div>
			<p>
				Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
				Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
				ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
				lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
			</p>
			<ul>
				<li>List item one</li>
				<li>List item two</li>
				<li>List item three</li>
			</ul>
		</div>
		<h3><a href="#">Section 4</a></h3>
		<div>
			<p>
				Cras dictum. Pellentesque habitant morbi tristique senectus et netus
				et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
				faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
				mauris vel est.
			</p>
			<p>
				Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
				Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
				inceptos himenaeos.
			</p>
		</div>
	</div>

	<hr/>

	<div id="tabs">
		<ul>
			<li><a href="#fragment-1"><span>One</span></a></li>
			<li><a href="#fragment-2"><span>Two</span></a></li>
			<li><a href="#fragment-3"><span>Three</span></a></li>
		</ul>
		<div id="fragment-1">
			<p>If you just click tabs.  No problem!</p>
		</div>
		<div id="fragment-2">
			But if you click tabs, then mess with accordion and come back to tabs, then you have incorrect tab states.
		</div>
		<div id="fragment-3">
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
			Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
		</div>
	</div>

	<style>
		.ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: red/*{bgColorHover}*/ /*{bgImgUrlHover}*/ 0/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; outline: none; }
	</style>

</body>
</html>

comment:2 Changed 11 years ago by Jörn Zaefferer

Component: ui.coreui.tabs
Milestone: TBD1.8

comment:3 Changed 9 years ago by petersendidit

Working testcase: http://jsfiddle.net/petersendidit/RW7Dn/

Confirmed it still a problem with Firefox 3.0 - 4.0 and UI 1.8.11

comment:4 Changed 9 years ago by Scott González

Resolution: fixed
Status: newclosed

The behavior in master seems to be very different than that of 1.8.x and this problem no longer exists.

Note: See TracTickets for help on using tickets.