Skip to main content

Search and Top Navigation

#5895 closed bug (patcheswelcome)

Opened August 02, 2010 04:33PM UTC

Closed December 23, 2012 11:25PM UTC

Button: Using .button() from inside an onchange handler prevents the button click in WebKit

Reported by: swalke16 Owned by:
Priority: major Milestone: 1.11.0
Component: ui.button Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

I have a basic form containing a button element that is styled with the .button() method, and a single textbox.

The button has a click event handler set on it to perform some action, in this case just an alert message.

The change event of the textbox is bound to a handler that uses the .button("option", "label", "value") method to change the text on the button.

If I change the value in the textbox and leave the field by clicking the button, the button text changes, but the click event of the button is never fired.

This behavior is only reproducible in google chrome. Firefox and IE work just fine.

Test case:

Attachments (0)
Change History (9)

Changed July 12, 2011 12:39AM UTC by bmsterling comment:1

Verified in "0245b72af87d3022f5dd780d03ff03d4751eca64" commit from github.

I've testing against A tags and submit inputs and submit inputs are working correctly but not links.

Also tested this in Safari 5 and it is in fact failing as well.

Doing the following does trigger the alert:

$("#btn").button('option', 'label', 'Changed').trigger( 'click' );
$("#btn").trigger( 'click' ).button('option', 'label', 'Changed');

Changed February 27, 2012 01:48PM UTC by jzaefferer comment:2

status: newopen

Still reproducible in current Chrome.

Changed October 11, 2012 09:04PM UTC by scottgonzalez comment:3

milestone: TBD1.11.0

Changed December 20, 2012 01:39PM UTC by tj.vantoll comment:4

keywords: ui.button, onchange
summary: Using the .button() function from inside an onchange handler prevents the button click in Google ChromeButton: Using .button() from inside an onchange handler prevents the button click in WebKit

Updated minified test case against master - The alert fires in IE10, Firefox, and Opera. It does not fire in the latest Chrome nor Safari.

Changed December 21, 2012 03:01PM UTC by tj.vantoll comment:5

This is a WebKit bug - I'll get around to filing a bug later tonight.

Changed December 23, 2012 09:55PM UTC by tj.vantoll comment:6

resolution: → wontfix
status: openclosed

Here's the WebKit bug - I'm going to close this as "wontfix" because I don't believe this is worth the hassle of trying to workaround the WebKit bug.

Changed December 23, 2012 09:57PM UTC by tj.vantoll comment:7

If someone can come up with a reasonable way of working around this issue feel free to send a pull request.

Changed December 23, 2012 11:25PM UTC by mikesherov comment:8

resolution: wontfix
status: closedreopened

Changed December 23, 2012 11:25PM UTC by mikesherov comment:9

resolution: → patcheswelcome
status: reopenedclosed