Opened 9 years ago

Closed 7 years ago

#5895 closed bug (patcheswelcome)

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:

Description

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:

http://jsbin.com/arenu/

Change History (9)

comment:1 Changed 8 years ago by bmsterling

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' );
and
$("#btn").trigger( 'click' ).button('option', 'label', 'Changed');

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

Status: newopen

Still reproducible in current Chrome.

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

Milestone: TBD1.11.0

comment:4 Changed 7 years ago by tj.vantoll

Keywords: ui.button onchange removed
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 - http://jsfiddle.net/tj_vantoll/NkSnH/. The alert fires in IE10, Firefox, and Opera. It does not fire in the latest Chrome nor Safari.

comment:5 Changed 7 years ago by tj.vantoll

This is a WebKit bug - http://jsfiddle.net/tj_vantoll/sNa3R/. I'll get around to filing a bug later tonight.

comment:6 Changed 7 years ago by tj.vantoll

Resolution: wontfix
Status: openclosed

Here's the WebKit bug - https://bugs.webkit.org/show_bug.cgi?id=105697. 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.

comment:7 Changed 7 years ago by tj.vantoll

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

comment:8 Changed 7 years ago by mikesherov

Resolution: wontfix
Status: closedreopened

comment:9 Changed 7 years ago by mikesherov

Resolution: patcheswelcome
Status: reopenedclosed
Note: See TracTickets for help on using tickets.