Closed Bug 181141 Opened 23 years ago Closed 22 years ago

Autocomplete dropdown in form remains after focus()

Categories

(Firefox :: Address Bar, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: belangery, Assigned: hewitt)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021119 Phoenix/0.4 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021119 Phoenix/0.4 When calling the Javascript function "focus" on a different "input" than the one being autocompleted, the autocomplete dropdown box stay up. The dropdown should be closed, since the focus is now passed to a different field. This scenario is frequent on page where the focus is switched when a certain number of characters is entered in a field. Reproducible: Always Steps to Reproduce: 1. Create a HTML file with the HTML code I provide below. 2. Open this HTML file with Phoenix. 3. Enter some text in Field #1 (you will see that once 4 characters entered, the focus is passed to the Field #2.) 4. Click the submit button. The page will reappear. 5. Start entering the same text in Field #1. The autocomplete dropdown is going to appear. 6. Press the "arrow down" key on your keyboard to highlight the first choice in the autocomplete dropdown. 7. Here's the bug. Actual Results: The focus has been passed to Field #2, but the autocomplete dropdown box is still there. Expected Results: The autocomplete dropdown box should disappear when the focus pass to Field #2. <!-- Here's the sample HTML page --> <HTML> <BODY> <FORM name="mainForm" method="GET" action="test.html"> Field #1 <INPUT type="text" name="field1" size="4" maxlength="4" onKeyDown="autoJump_onKeyDown('field1')" onKeyUp="autoJump_onKeyUp('field1','field2',4)"><BR><BR> Field #2 <INPUT type="text" name="field2"><BR><BR><BR> <INPUT type="submit"> </FORM> </BODY> </HTML> <SCRIPT language="JavaScript"> var activeField; function autoJump_onKeyDown(fieldName) { var field = document.mainForm.elements[fieldName]; activeField = field; field.lastValue = field.value; } function autoJump_onKeyUp(fieldName,nextFieldName,maxLength) { var field = document.mainForm.elements[fieldName]; var nextField = document.mainForm.elements[nextFieldName]; if (field == activeField && field.value != field.lastValue && field.value.length >= maxLength) nextField.focus(); activeField = null; } </SCRIPT>
Attached file test case
an html doc of the source provided by the user
Comment on attachment 106948 [details] test case ><HTML><HEAD/> ><BODY> > ><FORM name="mainForm" method="get"> > Field #1 <INPUT type="text" name="field1" size="4" maxlength="4" onkeydown="autoJump_onKeyDown('field1')" onkeyup="autoJump_onKeyUp('field1','field2',4)"/><BR/><BR/> > Field #2 <INPUT type="text" name="field2"/><BR/><BR/><BR/> > <INPUT type="submit"/> ></FORM> > ><SCRIPT language="JavaScript"> > > var activeField; > > > function autoJump_onKeyDown(fieldName) > > { > > var field = document.mainForm.elements[fieldName]; > > activeField = field; > > field.lastValue = field.value; > > } > > > function autoJump_onKeyUp(fieldName,nextFieldName,maxLength) > > { > > var field = document.mainForm.elements[fieldName]; > > var nextField = document.mainForm.elements[nextFieldName]; > > if (field == activeField &amp;&amp; field.value != field.lastValue &amp;&amp; > >field.value.length &gt;= maxLength) > > nextField.focus(); > > activeField = null; > > } > ></SCRIPT></BODY></HTML>
See also bug 180638, "using accesskey to move focus doesn't cancel autocomplete".
nsFormFillController.cpp problem.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Taking QA. Sorry for the bugspam
QA Contact: asa → davidpjames
Summary: Autocomplete dropdown in form stay up when calling Javascript function "focus" → Autocomplete dropdown in form remains after focus()
Flags: blocking1.0?
The test case worksforme on WindowsXP.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
Flags: blocking-aviary1.0?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: