List box Selected items are not updating properly (due to hidden inputs getting restored on refresh)
Categories
(Core :: DOM: Forms, defect)
Tracking
()
People
(Reporter: damith.jayasinghe, Unassigned)
References
Details
Attachments
(6 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0
Steps to reproduce:
This was started with latest update. HTML select element we write as follows.
<select>
<option selected>ABC</option>
<option>XYZ</option>
</select>
unfortunately Firefox is not recognize it. please look at the attachment
Actual results:
<option value="DR" selected="">INVOICE</option>
Expected results:
<option value="DR" selected>INVOICE</option>
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Form Controls' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•4 years ago
|
||
Is there any chance you could attach a test-case that reproduces the issue, or an URL that repros? Without that this is not really actionable, the HTML in comment 0 is selected as expected.
Reporter | ||
Comment 3•4 years ago
|
||
Hi Emilio, Shall I upload a video and share the link with you? Then it would be easy to understand. If you press ctrl + shift + r, Element "select" do what suppose to do. but press refresh button won't properly update the Element "select" options.
Comment 4•4 years ago
|
||
That seems expected, Firefox saves Form control state across regular refreshes, it's meant to prevent data loss. If you're generating the content dynamically you can use autocomplete=off to prevent it.
Comment 5•4 years ago
|
||
The severity field is not set for this bug.
:dholbert, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 6•4 years ago
|
||
Per comment 4, I think the described behavior is actually our intentional behavior, as a dataloss-prevention feature.
(It's also not specific to select boxes; it's true of form fields in general. This is indeed a behavior-difference with respect to Chrome; but it's a feature, not a bug.)
Comment 7•4 years ago
|
||
Here's a testcase to illustrate the behavior.
If you type text in the textfield, and/or change the selected item in the dropdown-menu, then that change is preserved through a Ctrl+R refresh.
(whereas Chrome resets the state of both formfields on Ctrl+R refresh.)
Reporter | ||
Comment 8•3 years ago
|
||
Please check this issue. This is a sample demo application for Invoicing. run on the localhost.
Firefox Video
https://drive.google.com/file/d/11I2JaMbpULvvos0M6HCHIezPNecd0XYL/view?usp=sharing
Google Chrome Video
https://drive.google.com/file/d/13D0P3L9Sh2ZrQJItfUrO6uFUpKLjiFpp/view?usp=sharing
Thanks
Updated•3 years ago
|
Comment 9•3 years ago
|
||
Ok, I agree that's unexpected, but it's hard to know what's going on without a repro.
Is there any chance you can provide a reproduction URI so that I can try to see what's going wrong? If it needs credentials you can mail them to me at the email in my profile or emilio [at] mozilla.com.
If not, can we at least see what is that plus button doing? Is it creating new elements and adding them to the page? I tried to come up with a simple repro that messed up the fields but I couldn't.
Reporter | ||
Comment 10•3 years ago
|
||
This happens in Version 95. I checked with older version (76) and this issue is not there. May be this is related to something newly added RLBox feature. I will send you a live link to test with credentials. Please grant me few hours to setup one.
What plus button doing is, cloning the previous row and do some amendments. I have attached the code here.
Reporter | ||
Comment 11•3 years ago
|
||
Code of plus mark
Comment 12•3 years ago
|
||
The severity field is not set for this bug.
:boris, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
Reporter | ||
Comment 13•3 years ago
|
||
Hi, Please check the following URL and uploaded video for sample.
http://206.217.140.122/firefoxissue/
https://drive.google.com/file/d/1V-sEr3XLFtyczERjizqGgVp-8ss11Smo/view?usp=sharing
Code :
https://drive.google.com/drive/folders/1iZZuKe2-2iw26PVVUusYtAjUtDeHCNiR?usp=sharing
Reporter | ||
Comment 14•3 years ago
|
||
Reporter | ||
Comment 15•3 years ago
|
||
Reporter | ||
Comment 16•3 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #9)
Ok, I agree that's unexpected, but it's hard to know what's going on without a repro.
Is there any chance you can provide a reproduction URI so that I can try to see what's going wrong? If it needs credentials you can mail them to me at the email in my profile or emilio [at] mozilla.com.
If not, can we at least see what is that plus button doing? Is it creating new elements and adding them to the page? I tried to come up with a simple repro that messed up the fields but I couldn't.
Hi Emilio, Please see below video and sample to try
Video : https://drive.google.com/file/d/1V-sEr3XLFtyczERjizqGgVp-8ss11Smo/view?usp=sharing
Live Test : http://206.217.140.122/firefoxissue/
Code: https://drive.google.com/drive/folders/1iZZuKe2-2iw26PVVUusYtAjUtDeHCNiR?usp=sharing
Updated•3 years ago
|
Comment 17•3 years ago
|
||
Ok, so this is a side effect of the way you keep track of the counter in the hidden input.
The code you attached is not quite right, you can see it if you click on the same add button multiple times on any browser.
The issue is that you're keeping track of the counter on the hidden input, but we're restoring its value when you refresh. This is since bug 149962, and it is a feature rather than a bug.
You could keep track of the counter some other way, or tag the hidden input with autocomplete="off"
if you don't want Firefox to restore it on refresh.
Updated•3 years ago
|
Description
•