Multi Select <select> box on mobile devices

33,424

Solution 1

This behavior in mobile browsers is by design to improve user experience . According to Safari Web Content Guide

Use the Select Element If you use the select HTML element in your webpage, iOS displays a custom select control that is optimized for selecting items in the list using a finger as the input device. On iOS, the user can flick to scroll the list and tap to select an item from the list.

This being said:

  • I'd recommend not fight it but leverage it for sake of mobile users

  • use media-queries to apply different css for your select elements for desktop and mobile browsers;

  • if number of options displayed is small enough consider using <input type="checkbox">

    instead of select because it's behavior is consistent across browsers.

Solution 2

I've been using a similar interface, and it has worked great for desktop users, but is completely un-intuitive on touch devices where a multi-select is not displayed as a multi-line scrollable list.

It seems like you need an entirely custom control, but I've found two Jquery controls that appear to implement this functionality (although in a slightly different way).

Eric Hynds Jquery UI multiselect: http://comsim.esac.esa.int/rossim/3dtool/common/utils/jquery/ehynds-jquery-ui-multiselect-widget-f51f209/demos/index.htm

Quasi Partikels sortable searchable multi-select widget: http://quasipartikel.at/multiselect/

Both of these appear a little fiddly on a phone size device, but particularly the Quasi Partikel version which uses a small "+" on the left of an item to add it, whereas Eric Hynds allows the entire item to be tapped to select/deselect. Either could be improved with mobile specific styles to increase the size of critical elements I suppose.

Solution 3

From what I understand, I think it would be much easier to redirect to another page depending on the option selected unless there is a reason you didn't choose this in the first place.

I don't see why you can't just use a dropdown list of checkboxes. These are compatible pretty much everywhere and certainly on all smartphones.

<select name="Dropdown1">
<option value="o1">Option 1</option>
<option value="o2">Option 2</option>
<option value="o3">Option 3</option>
<option value="o4">Option 4</option>
</select>

Or

<input type="checkbox" name="checkbox" value="o1">Option 1<br>
<input type="checkbox" name="checkbox" value="o2">Option 2

(http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select2 and http://www.w3schools.com/html/html_forms.asp)

Share:
33,424
Patricia
Author by

Patricia

Web Developer Primarily dealing with asp.net mvc, and jquery.

Updated on July 09, 2022

Comments

  • Patricia
    Patricia almost 2 years

    I have an interface which uses multi select listboxes with a css set height to populate other lists.

    Basically:

    <select multiple="multiple" size="5" style="height:150px;">
        <option value='1'>one</option>
        <option value='2'>two</option>
        <option value='3'>three</option>
        <option value='4'>four</option>    
    
    </select>
    
    <select multiple="multiple" style="height:150px;"></select>
    

    Using jQuery, basically you select some things in the first one, and it moves them to the second one.

    This works great, and our users like it in non-mobile environments. BUT, on android tablets, phones, iphones and ipads, the lists look empty until you click and it shows the built in scrolling select interface. So you can't see the new ones when they are added to the second list.

    This very simple jsFiddle shows what I am talking about with the select boxes not showing their content:

    http://jsfiddle.net/VhXwA/2/

    Is there a way to override this behaviour without having to make my own custom thing, or use an entirely different way of doing this for mobile devices?

    If there isn't a way to do that, what would be the best way to implement something like that that is mobile friendly?

    Edit:

    Here is a basic picture of how this interface looks, the lists in either box could be very long or short. but they have a set height, for consistency: Example

    Edit: I can't imagine I'm the only one who's come across this! There has got to be a way to make the mobile browsers behave properly.

  • Patricia
    Patricia over 11 years
    the list could be very long, checkboxes would be unwieldy. They can also change the order of the selected options, so checkboxes wouldn't really work at all.
  • Patricia
    Patricia over 11 years
    checkboxes aren't an option because they can also change the order, but clicking an up / down button with open of the option selected.
  • bazite
    bazite over 11 years
    @Patricia On some websites, hundreds of options can be listed on dropdown lists, like when a user chooses their country, so dropdowns can be used with any number of items, really. I don't see what the problem with them is...
  • Patricia
    Patricia over 11 years
    the problem is, they are showing up EMPTY on the mobile interface, until they are click on. and they they are shown with the more user friendly (for some cases) mobile interface, where is a srollable list. For multi select, and for this particular interface. Where they can select and remove, or select and move up and down. it's just not user friendly at all.
  • Testo Testini
    Testo Testini about 4 years
    in short: because is an ordered list