Closed Bug 419067 Opened 17 years ago Closed 17 years ago

Using setAttribute to toggle a text boxes disabled attribute makes it unusable

Categories

(Core :: General, defect)

1.8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: neil, Unassigned)

Details

Attachments

(2 files)

In Firefox 2.0.0.12, I created a textbox in xul and then I toggled the disabled attribute by using setAttribute("disabled", true); When I re-enable it by using the same method, suddenly clicking in the center of the textbox is no longer possible. DOM Inspector won't even detect a click in the center. Clicking on the border fires the focus event off but you can't see any typing in it. If you set the value of it through code, you can see that show up. Workaround: Use removeAttribute("disabled"); and I hear just setting "textbox.disabled = true;" works but I have yet to try it out.
Type some text in the textbox. Click the toggle button to disable it. Click it again to re-enable it. Try to type in the textbox again.
Attachment #305039 - Attachment description: Minimal test case. → Example using the removeAttribute which works.
Is this a recent regression? Did it work in Firefox 2.0.0.11?
Product: Firefox → Core
QA Contact: general → general
Version: 2.0 Branch → 1.8 Branch
Now that I look at this again, I think this might be caused by a discrepancy in "disabled" attribute handling. Perhaps the code that disables editing is triggered merely by the presence of the attribute, while the disabled styling only takes effect if it's value is "true"? I can reproduce this in 1.8.0 and trunk builds as well.
Yes, this is because for html <input>, the disabled state applies whenever the attribute is present regardless of its value. textbox.disabled = true/false is the correct way to change the disabled state. Script properties should always be used in place of attribute changing whenever possible.
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: