orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
511 stars 220 forks source link

Dropdown to always show empty as the first value, instead of "Please select:" #6389

Open avernet opened 1 week ago

avernet commented 1 week ago

For the current behavior, and argument for making this change watch the following video.

https://github.com/orbeon/orbeon-forms/assets/106961/61f8d4c3-5ec6-4e4d-b528-4268b811770b

+1 from customer

avernet commented 5 days ago

That's a tough one. I'm not finding a way to have the dropdown show "Please select:" when closed, and when opened have the first choice be empty instead of "Please select...".

I have a prototype where "Please select:" is shown above the dropdown when the value is empty, but getting this to display properly across browsers and operating systems seems finicky.

avernet commented 5 days ago

Idea: Rely on <option hidden selected>Please select:</option> being shown in the dropdown when closed, but not when open. When no value is selected, the first item is <option hidden selected>Please select:</option>. However, when a value is selected, we change it to <option/>.

To implement this, we need to support xxf:hidden="{...}" on <xf:item>. This support should be added in the content handler, Ajax response, and XFormsUI.

avernet commented 5 days ago

Idea: Rely on <option hidden selected>Please select:</option> being shown in the dropdown when closed, but not when open.

Bummer: that works with Chrome, but not with Safari. Back to the drawing board.

avernet commented 2 days ago

The two options that are both consistent and certain possible to implement without "hacks" with native dropdowns are to: