WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
137067
REGRESSION (iOS 8): <select> values are not properly updated in a form with multiple <select>s
https://bugs.webkit.org/show_bug.cgi?id=137067
Summary
REGRESSION (iOS 8): <select> values are not properly updated in a form with m...
Andrew Hall
Reported
2014-09-24 07:50:43 PDT
We have now discovered *another* iOS 8 issue on Safari with select/dropdown elements. In order to reproduce the issue, you need a form that contains multiple dropdowns 1) Set the value of one drop downs to be 2nd item 2) In another dropdown, select the 3rd item, but do not click done 3) Click back on the original <select> element from step 1. 4) The 3rd item will be displayed as selected in the first element, not the 2nd as you set in step 1 – but in the selection box the correct value will be shown When moving from one dropdown to another, it seems to set the index of the newly selected dropdown to the index of the dropdown that you have clicked away from. You can fix this with jQuery by intercepting the change event and reselecting the correct value. $('select').bind('focus', function () { var curVal = $(this).get(0).selectedIndex; window.setTimeout(function(){ $(this).get(0).selectedIndex = curVal; $(this).click(); }.bind(this),50); }); However, you need to be wary – this bug does call the change event of the select when incorrectly selecting the value
Attachments
Testcase demonstrating the problem
(679 bytes, text/html)
2016-02-18 20:32 PST
,
Chris Rebert
no flags
Details
Screenshot showing the problem
(81.78 KB, image/png)
2016-02-18 20:35 PST
,
Chris Rebert
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-09-26 21:53:09 PDT
<
rdar://problem/18477482
>
Reid Lyons
Comment 2
2015-10-20 08:32:56 PDT
I can recreate this in iOS 9. Would you increase the priority of this issue?
Michael Trinque
Comment 3
2015-11-14 10:20:38 PST
I find the following to be a better solution provided that you are not making use of disabling selects in your application (though obviously one could alter the code below to account for that as well): var selects = $('select'); if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { selects.blur(function() { selects.prop('disabled', false); }).focus(function() { selects.not(this).prop('disabled', true); }); } I'd like to point out that this has been open for over a year and has yet to be either acknowledged or fixed. The code causing this bug *must* be extremely sloppy, something to the effect of "set whichever select box is focused to the index of the picked option" and not the sane "set the select box *associated with this option* to the option's index". I'm glad the iPad/iPhone is getting thinner and all... great; lets see some improvement on the software side of this 100bn+ empire.
Michael Trinque
Comment 4
2015-11-14 16:51:17 PST
In fact my solution did *not* work. We've instead used this: if (navigator.userAgent.match(/(iPod|iPhone|iPad)/)) { selects.blur(function() { selects.css('display', ''); }).focus(function() { selects.not(this).css('display', 'none'); }); } This prevents any possibility that the user can tap another select until after completing their current selection. While painful, as there has been no official attention to this user I suppose it will have to do.
Walt
Comment 5
2016-02-16 05:21:27 PST
+1 please fix
Chris Rebert
Comment 6
2016-02-18 20:32:32 PST
Created
attachment 271727
[details]
Testcase demonstrating the problem
Chris Rebert
Comment 7
2016-02-18 20:35:30 PST
Created
attachment 271728
[details]
Screenshot showing the problem Still reproduces in iOS 9.2.1 Here are a testcase and screenshot to clarify.
sladex
Comment 8
2017-11-07 23:50:26 PST
Still experiencing this bug in iOS 10.
Erik Ostrom
Comment 9
2020-08-21 11:22:00 PDT
Still experiencing this bug in iOS 13. A side effect is that when the display switches to the first option, a change event is sent, as though the user had committed a change to the first element. If the user closes the dropdown without changing their selection, another change event is sent.
kenny
Comment 10
2020-09-02 10:24:33 PDT
I created this issue before finding this one for ios 13 I've seen production errors with this exact bug
https://bugs.webkit.org/show_bug.cgi?id=216077
Has link to codepen demonstrating the problem.
Karl Dubost
Comment 11
2024-05-08 00:58:06 PDT
I just tried on the latest version of Safari on iOS with iOS 17.4
https://bugs.webkit.org/attachment.cgi?id=271727
And this is working for me.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug