This PR turns the free text input field for the country code in the WiFi dialog into a <select> dropdown, to make it easier for users to choose their correct and applicable country code value.
A few notes:
I thought the simplest approach to retrieve the available country codes was by copying them over from the /usr/share/zoneinfo/iso3166.tab file. An alternative would be to parse the file in the backend, and retrieve the list dynamically via an API endpoint. That would then also allow us to validate the input value against this list in the request parser. However, I think the cost<>benefit ratio of such an implementation would be questionable, especially considering that the ISO definitions don’t seem to change very often.
I adjusted the input field label from “Country Code” to “Country”. I still suggest to display the country codes in the options (e.g., United States (US)) for informational reasons, to satisfy both technical and non-technical users.
I removed the size attribute of the <input> field in favor of a width, to make the sizing match the one of the <select> field. The latter has slightly different box sizing behaviour, so it’s width differs by 1em.
Related https://github.com/tiny-pilot/tinypilot/issues/131, part (h). Stacked on https://github.com/tiny-pilot/tinypilot/pull/1819.
This PR turns the free text input field for the country code in the WiFi dialog into a
<select>
dropdown, to make it easier for users to choose their correct and applicable country code value.A few notes:
/usr/share/zoneinfo/iso3166.tab
file. An alternative would be to parse the file in the backend, and retrieve the list dynamically via an API endpoint. That would then also allow us to validate the input value against this list in the request parser. However, I think the cost<>benefit ratio of such an implementation would be questionable, especially considering that the ISO definitions don’t seem to change very often.United States (US)
) for informational reasons, to satisfy both technical and non-technical users.size
attribute of the<input>
field in favor of awidth
, to make the sizing match the one of the<select>
field. The latter has slightly different box sizing behaviour, so it’s width differs by1em
.