Closed Bug 92858 Opened 24 years ago Closed 24 years ago

[FILE INPUT] can change the contents of a DISABLED <input type=file> by using keyboard navigation

Categories

(Core :: Layout: Form Controls, defect, P2)

x86
All
defect

Tracking

()

RESOLVED FIXED
mozilla1.1alpha

People

(Reporter: madhur, Assigned: john)

References

()

Details

(Keywords: html4, Whiteboard: [FIX][HTML17.4.1])

Attachments

(2 files)

build ID : 2001-07-27 OS : tested on win2000, linux redhat 7.1, and macOS 8.6 If i use the tab key to navigate through the form-control [FILE INPUT]and hit the enter key to the corresponding control (whether it is disabled or not) , i get a file upload dialog box and am able to select anmd upload a file to show in the control. steps to reproduce: 1. open the testcase via the above mentioned URL 2. tab to the first control - this is an enabled [file input] control. 3. hit the enter key what happens ? -- the file upload dialog box will appear. select a file and say open. the file selected will be uploaded in the enabled <input file> control. 4. U will have to hit the key once or twice more -- so that the focus is removed from the enabled control. actual: ======= what happens? --- the next control is the disabled <input file> control. you will notice that there is no visible focus on this control. Hit the "Enter" key. Again -- the file upload dialog box will appear. select a file and say open. the file selected will be uploaded in the disabled <input file> control. The disabled control seems to have a focus, though there is no visible evidence -- the carat sign does not flicker in this control. expected: ========= disabled controls are not supposed to get focus of any kind.
to rerpoduce this bug effectively, set the focus (cursor shows) on the enabled <input file> control. Hit the tab key ( the focus should be removed from this enabled control) till u do not see the cursor blinking in that control anymore. Now repeat step number 4 as mentioned above. This is very much reproducible and should be considered for an immediate fix. Happens on all platforms.
I would argue that this is a focus bug. The focus should go to the file control. Here is a patch to fix this for now: Index: nsFileControlFrame.cpp =================================================================== RCS file: /cvsroot/mozilla/layout/html/forms/src/nsFileControlFrame.cpp,v retrieving revision 3.112 diff -u -r3.112 nsFileControlFrame.cpp --- nsFileControlFrame.cpp 2001/08/25 02:00:10 3.112 +++ nsFileControlFrame.cpp 2001/08/27 17:26:35 @@ -248,6 +248,10 @@ nsresult nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) { + if (nsFormFrame::GetDisabled(this)) { + return NS_OK; + } + // only allow the left button nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent); if (mouseEvent) {
Status: NEW → ASSIGNED
Priority: -- → P1
Summary: [FILE INPUT] can change the contents of a DISABLED <input type=file> by using keyboard navigation → [FIX][FILE INPUT] can change the contents of a DISABLED <input type=file> by using keyboard navigation
Whiteboard: fix in hand
Target Milestone: --- → mozilla0.9.5
moving to 0.9.6
Target Milestone: mozilla0.9.5 → mozilla0.9.6
still reproducable on build ID: 2001-10-16-05-0.9.4 (branch build)- win32
Target Milestone: mozilla0.9.6 → mozilla0.9.9
Beyond the problem with the mouse is that the input text inside the file control will end up getting focus. Focus is "suppose" to skip a disabled element. It appears it isn't skipping it's children. May this is really a combination focus bug and formm control bug. It the focus manager could check to see if it is a "replaced" element then it should traverse down into thes children. So when the file control is disabled we have to keep the input (and maybe event the button from getting focus. John, feeel free to future this if it is deemed "not worthy" for .99 or 1.0 One test is to tab into it and hit return.
Assignee: rods → jkeiser
Status: ASSIGNED → NEW
Summary: [FIX][FILE INPUT] can change the contents of a DISABLED <input type=file> by using keyboard navigation → [FILE INPUT] can change the contents of a DISABLED <input type=file> by using keyboard navigation
Maybe the best thing to do is to just propagate DISABLED to the button and textbox. I wonder if there are other attributes or properties that should be propagated. Moving to 1.0, seems important (data integrity).
Target Milestone: mozilla0.9.9 → mozilla1.0
Moving to Moz1.1. Engineers are overloaded with higher priority bugs.
Priority: P1 → P2
Target Milestone: mozilla1.0 → mozilla1.1
*** Bug 127861 has been marked as a duplicate of this bug. ***
Keywords: html4
Whiteboard: fix in hand → fix in hand[HTML17.4.1]
QA Contact: madhur → tpreston
Keywords: nsbeta1
Status: NEW → ASSIGNED
The proper fix seems to me to set the anonymous content disabled when the file content is set disabled. This goes for readonly too.
Attached file testcase
This testcase tests file inputs with disabled initially and set with JS; and tests setting size, since I am changing that in the patch
Attached patch PatchSplinter Review
This patch propagates the disabled attribute to the input type=text and button. It also changes mBrowse and mTextContent to be nsIContent*'s for efficiency purposes (a lot less QI's but all the same functionality). Finally, it removes an unnecessary StyleChangeReflow() when the size attribute is dynamically changed. Everything still reflows correctly.
Whiteboard: fix in hand[HTML17.4.1] → [FIX][HTML17.4.1]
BTW, I did not fix readonly because it is explicitly defined in the spec as applying only to input type="text" and "password".
Comment on attachment 86192 [details] [diff] [review] Patch r=rods
Attachment #86192 - Flags: review+
Fix checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: