Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#5960 closed bug (duplicate)

[RFC] Problem with fast clicking on large button

Reported by: juliobiason Owned by:
Priority: minor Milestone:
Component: ui.button Version: 1.8.4
Keywords: Cc:
Blocked by: Blocking:

Description

We have a large buttonset (around 36 elements) and we found that, sometimes, when we click really fast (i.e. toggle the status of some closer elements), the button would get a ui-state-active class, but neither its aria or checked would change. This could be checked in Firefox 3.6.x and 4.0b3.

I had the impression that, when we did that, the event being currently dealt with got interrupted and the new event would take control. So the class would change, but not the status of the checkbox behind it (Note: I'm talking this out of my ass, I don't have enough knowledge about the internals of Firefox).

The solution I found was to force everything to happen in a single pass, basically "blocking" any other actions till everything could be changed at once (again, out of my ass.)™

The changed code: (in jquery-ui-1.8.4.custom.js, around line 5384):

				if ( options.disabled ) {
					return false;
				}
				// inverted controls
				if(self.element[0].checked) {
					$(this).removeClass('ui-state-active');
					self.buttonElement.attr('aria-pressed', false);
					self.element[0].checked = false;
					return false;
				} else {
					$(this).addClass('ui-state-active');
					self.buttonElement.attr('aria-pressed', true);
					self.element[0].checked = true;
					return false;
				}

It worked for us, but I'm not sure if this solves another problem (#5518 comes to my mind, after reading their report) or actually causes more problems.

Is this code safe?

Change History (5)

comment:1 Changed 9 years ago by juliobiason

Btw, if anyone wants to check the running code, we have it at:

http://iplenix.com/ms/demo/iplenix/reports.tpl

comment:2 Changed 9 years ago by nachoab

Will this ever get fixed ? if I click rapidly on a button, it skips the click event just like he says but with every single button. Very annoying. Can't believe this has 5 months.

By the way, that workaround isn't working for me.

[EDIT]

Ok, now it works, although there is a mistake, it should be:

if(!self.element[0].checked) {

$( this ).removeClass( "ui-state-active" ); self.buttonElement.attr( "aria-pressed", false ); self.element[0].checked = false;

} else {

$( this ).addClass( "ui-state-active" ); self.buttonElement.attr('aria-pressed', true); self.element[0].checked = true;

}

its not the best but at least you won't have an active button without the active button effect.

Last edited 9 years ago by nachoab (previous) (diff)

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

Resolution: duplicate
Status: newclosed

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

Duplicate of #5518.

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

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.