Skip to main content

Search and Top Navigation

#9169 closed bug (fixed)

Opened March 19, 2013 04:45PM UTC

Closed April 11, 2013 06:04PM UTC

Last modified November 25, 2013 09:55PM UTC

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

Attachments (0)
Change History (11)

Changed March 19, 2013 04:49PM UTC by scottgonzalez comment:1

owner: → 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?

Changed March 19, 2013 05:11PM UTC by Cody comment:2

status: pendingnew

Replying to [comment:1 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?

[[Image(http://i.imgur.com/R7YSMBS.png)]]

Changed March 19, 2013 06:59PM UTC by scottgonzalez comment:3

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

That's very odd.

Changed March 20, 2013 01:55AM UTC by tj.vantoll comment:4

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.

Changed April 11, 2013 04:40PM UTC by tj.vantoll comment:5

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.

Changed April 11, 2013 05:17PM UTC by scottgonzalez comment:6

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.

Changed April 11, 2013 05:41PM UTC by scottgonzalez comment:7

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().

Changed April 11, 2013 06:04PM UTC by Scott González comment:8

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

Changed April 11, 2013 06:04PM UTC by scottgonzalez comment:9

milestone: none1.11.0

Changed November 25, 2013 09:54PM UTC by Scott González comment:10

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

Changed November 25, 2013 09:55PM UTC by scottgonzalez comment:11

milestone: 1.11.01.10.4