Mobile Safari Multiselect Bug & Knockout Workaround

117 views
Skip to first unread message

Tim Kremer

unread,
Mar 13, 2016, 9:24:07 PM3/13/16
to KnockoutJS
Hi there,

There seems to be a well known bug in browser Multiselect affecting the last several ios versions (affecting safara & chrome)

See stackoverflow discussion here: http://stackoverflow.com/questions/34660500/mobile-safari-multi-select-bug

and seems to go back to ios7: https://discussions.apple.com/thread/5548742?start=0&tstart=0

The workaround suggested on Stack Overflow is to insert a disabled Option element at the beginning of the list of options, like this:

<select multiple>
    <option disabled></option>

    <option value="test1">Test 1</option>
    <option value="test2">Test 2</option>
    <option value="test3">Test 3</option>
</select>

I think this needs to be set up during the inital options load, rather than as something added after render.
Any suggestions on how to achieve this with Kockout's options bindings?

Thanks so much

Kind regards,

Tim Kremer

Tim Kremer

unread,
Mar 14, 2016, 4:43:58 AM3/14/16
to KnockoutJS
Hi All,

An update:

 I have found using Knockout's optionsCaption to add a first option element,  and then using optionsAfterRender to disable that additional option seemed to work ok.

Hope that helps someone else

Tim

Ian Yates

unread,
Mar 14, 2016, 7:34:06 PM3/14/16
to KnockoutJS
Looks like an ugly bug.  Thanks for sharing the fix!
Reply all
Reply to author
Forward
0 new messages