Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8 multiple <select> serious bug on iPhone?

In iOS 8.0, Apple introduced a new bug in Safari on iPhone, which I think is very serious when using multiple <select> elements. It's commonly used for example to select day of birth. To reproduce:

  1. Create a page with two <select> with multiple <option> in each

  2. Open in Safari on iOS 8 on iPhone (The bug still exists in 8.0.2)

  3. Tap the first <select>

  4. Choose the third option i.e. March

  5. Notice that it doesn't update the <select> to what you chose (it does in iOS 7)

  6. Tap the second <select> element

  7. Notice the following:

    • The first <select> doesn't update
    • The second <select> shows 3 (which is the position of the first <select>)
    • The picker below shows 1

You can repeat this by alternating between tapping the first and second <select>, and notice that it changes in the same pattern. This may appear randomly unless you know the pattern). It looks even more confusing if you also have a year-picker.

To try in your mobile device, try this jsfiddle: http://jsfiddle.net/m7baw590/6/embedded/result/

Also, the onchange="alert(this.value)" reports an incorrect value (the same that is selected on the second <select> element. You can see this here: http://jsfiddle.net/m7baw590/7/embedded/result/

These bugs does not occur if you click "Done" between each selection, or use the arrows to switch.

Is there any workaround for this?

like image 897
Niclas Avatar asked Sep 30 '14 09:09

Niclas


People also ask

How do you multi select on iPhone?

To select multiple items, drag two fingers over the items you want to select. When the view recognizes the two-finger pan gesture, it changes to edit mode, allowing you to select more than one item. The selected items don't have to be contiguous.

Can you do a select all on iPhone?

Essentially, what you want to do is press down on a single word in the section of text that you want to select. After second, lift your finger. You will then be able to move the pointers around to select how much or how little of the text you want to select.

Where is the Select All button on iPhone?

iOS provides a single tap "Select All" button only in certain places in the Photos app. For the sections that don't, pressing "Select" at the top-right corner, tapping the last photo, and swiping to the far left and up will select all the images in the folder.


2 Answers

I solved the problem this way:

<select>
    <option></option>
    <option></option>
    <option></option>
    (...)
    <optgroup disabled></optgroup>
</select>

Just added an empty <optgroup> to the <select>.

like image 83
rdshck Avatar answered Oct 18 '22 16:10

rdshck


I discovered another bug with select fields in iOS8 (Only on iPhone, iPad seems fine for example).

http://jsbin.com/kuhogopafe/1

How to reproduce:

  • Select 3 options
  • Unselect one option again
  • Result: instead of 2 selected options, only the last unselected option is reported as selected now
like image 28
Alex Avatar answered Oct 18 '22 14:10

Alex