Autofill updates the values of readonly, disabled fields
Categories
(Toolkit :: Form Autofill, defect)
Tracking
()
People
(Reporter: dan_256, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:65.0) Gecko/20100101 Firefox/65.0
Steps to reproduce:
Create an address form as follows:
<form method="post"><table>
<tbody><tr>
<td>Name</td>
<td colspan="7"><input style="width:100%;" name="name"></td>
</tr>
<tr>
<td>Address</td>
<td colspan="7"><input style="width:100%;" name="address"></td>
</tr>
<tr>
<td>City</td>
<td><input name="City"></td>
<td>State</td>
<td><input name="state"></td>
<td>Zip</td>
<td><input name="Zip"></td>
<td>Country</td>
<td><input readonly="true" disabled="true" name="country"></td>
</tr>
<tr>
<td colspan="8"><input type="submit" value="Submit"></td>
</tr>
</tbody></table></form>
Start typing into the address fields, and autofill will offer to use any of the addresses you've typed in before. Choose one with a country, and it will fill in the country field, despite it being disabled and readonly.
Actual results:
Country field is filled in by autofill.
<input readonly="true" disabled="true" name="country">
Expected results:
A readonly or disabled field should not be fillable by the user, and by extension autofill. Autofill should only fill fields the user could fill manually.
In our application, we auto-filled the country field with a derived value from the state or province. But somehow, some users would fill in the country with alternate spellings (US vs USA). We have finally tracked it down to Firefox autofill overriding our readonly field's behavior.
It is possible to workaround this behavior by setting autocomplete off on the field. However, this should not be required for a read-only field.
I have also tested in Chrome, and it honors the readonly/disabled attribute, and does not fill in the field.
Hi Dan,
Thank you for taking the time to add your report.
As far as I understand it, this is a known issue that is being tracked here: https://bugzilla.mozilla.org/show_bug.cgi?id=1436793.
Description
•