Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9169 closed bug (fixed)

Button: Disabled button maintains ui-state-focus in IE & Firefox on Windows

Reported by: Cody Owned by: Cody
Priority: minor Milestone: 1.10.4
Component: ui.button Version: 1.10.1
Keywords: Cc:
Blocked by: Blocking:

Description

using Firefox 19.0.2 on Windows 7, jQuery 1.9.1, jQuery UI 1.10.1 Repro: http://jsfiddle.net/qXLn9/ Click the second button Expected: When disabled, the button loses focus (works in IE, chrome) Actual: The button is disabled, but still has the class ui-state-focus

Change History (11)

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

Owner: set to Cody
Status: newpending

I'm not seeing that behavior in Firefox on OS X and that fiddle isn't using jQuery UI 1.10.1.

Can you provide another fiddle, perhaps one that will also assert that the class exists while disabled, rather than requiring inspection?

comment:2 in reply to:  1 Changed 5 years ago by Cody

Status: pendingnew

Replying to scott.gonzalez:

I'm not seeing that behavior in Firefox on OS X and that fiddle isn't using jQuery UI 1.10.1.

Can you provide another fiddle, perhaps one that will also assert that the class exists while disabled, rather than requiring inspection?

Sorry, but I didn't see how to choose a different version of jQuery UI on jsFiddle. I tried this in Firefox on OS X and could not repro there, but I still can on Windows. Can you please try to repro on a windows machine?

http://i.imgur.com/R7YSMBS.png

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

Status: newopen
Summary: Disabled button remains focused in FirefoxButton: Disabled button maintains ui-state-focus in Firefox/Windows

That's very odd.

comment:4 Changed 5 years ago by tj.vantoll

Summary: Button: Disabled button maintains ui-state-focus in Firefox/WindowsButton: Disabled button maintains ui-state-focus in IE & Firefox on Windows

Here's a test case against master that makes the issue a little more obvious: http://jsfiddle.net/tj_vantoll/vfqJu/.

I was able to recreate this on Firefox, but the problem also occurs on IE 7 - 10 as well. I tried a variety of other browsers on Windows and the issue was not present.

This is indeed very odd.

comment:5 Changed 5 years ago by tj.vantoll

This occurs because Gecko and Trident apparently do not fire blur events on disabled buttons and WebKit and Presto do.

Here's a test case that shows this without jQuery: http://jsfiddle.net/3e5ek/.

Thing is... I don't know which behavior is correct. Should the browser fire a blur event?

Anyways I think the only thing we can do here is switch to using the :focus pseudo-selector instead of using the ui-state-focus class. That will be safe to do once we drop IE7.

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

I believe that's a browser bug. We should file issues for this. Of course the problem with that is it'll be a long time before we'd be able to rely on that in IE.

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

Actually, this is an interesting problem because the button doesn't blur by becoming disabled and disabled elements don't normally trigger events. Anyway, this should be covered by _focusable().

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

Resolution: fixed
Status: openclosed

Button: Remove ui-state-focus class when becoming disabled. Fixes #9169 - Button: Disabled button maintains ui-state-focus in IE & Firefox on Windows.

Changeset: 0d0b05ec7cf702b8782b19c993eeb30398a090f4

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

Milestone: none1.11.0

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

Button: Remove ui-state-focus class when becoming disabled. Fixes #9169 - Button: Disabled button maintains ui-state-focus in IE & Firefox on Windows. (cherry picked from commit 0d0b05ec7cf702b8782b19c993eeb30398a090f4)

Conflicts:

ui/jquery.ui.button.js

Changeset: 6e48da049014c484a219df11ab8f0551afb27fb5

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

Milestone: 1.11.01.10.4
Note: See TracTickets for help on using tickets.