Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Issue 2446003002: settings-dropdown-menu must set <select>#value after its options change (Closed)

Created:
4 years, 1 month ago by michaelpg
Modified:
4 years, 1 month ago
Reviewers:
dpapad
CC:
arv+watch_chromium.org, chromium-reviews, dbeam+watch-settings_chromium.org, dcheng, michaelpg+watch-md-settings_chromium.org, michaelpg+watch-md-ui_chromium.org, stevenjb+watch-md-settings_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

settings-dropdown-menu must set <select>#value after its options change The |value| property of an HTMLSelectElement is a getter/setter, not a POD variable. Setting it performs an algorithm which is something like: 1. Let O be the first <option> in my children whose "property" attribute equals |value|. 2. If O exists, add the "selected" attribute to O. As a result, a vanilla Polymer binding is not safe if the contents are dynamically generated: <select value="[[myValue]]"> <template is="dom-repeat" items="[[myItems]]"> <option value="[[item.value]]">[[item.name]]</option> </template> </select> because if |myValue| already has a particular value, and then |myItems| is set, |myValue| has the correct value but the <select>'s |value| "setter" is not called. Thus the option is never actually selected. Fix this by setting |value| directly instead of in a data binding. Also, ensure "Custom" can't be selected when hidden via type-ahead. BUG=658075 R=dpapad@chromium.org TEST=CrSettingsDropdownMenu browser test CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/b02d4b3efb575bb85e49404940a84cc616a48388 Cr-Commit-Position: refs/heads/master@{#427792}

Patch Set 1 #

Total comments: 8

Patch Set 2 : Compute showNotFoundValue_ (nvm, see next) #

Patch Set 3 : Hide custom option via CSS #

Unified diffs Side-by-side diffs Delta from patch set Stats (+50 lines, -26 lines) Patch
M chrome/browser/resources/settings/controls/settings_dropdown_menu.html View 1 2 1 chunk +7 lines, -3 lines 0 comments Download
M chrome/browser/resources/settings/controls/settings_dropdown_menu.js View 1 2 3 chunks +19 lines, -16 lines 0 comments Download
M chrome/test/data/webui/settings/dropdown_menu_tests.js View 1 2 6 chunks +24 lines, -7 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 29 (13 generated)
michaelpg
PTAL.
4 years, 1 month ago (2016-10-25 00:31:32 UTC) #3
dpapad
https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html File chrome/browser/resources/settings/controls/settings_dropdown_menu.html (right): https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html#newcode18 chrome/browser/resources/settings/controls/settings_dropdown_menu.html:18: hidden$="[[!showNotFoundValue_(menuOptions, pref.value)]]" showNotFoundValue is performing an O(n) search, for ...
4 years, 1 month ago (2016-10-25 01:02:38 UTC) #4
dpapad
https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html File chrome/browser/resources/settings/controls/settings_dropdown_menu.html (right): https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html#newcode18 chrome/browser/resources/settings/controls/settings_dropdown_menu.html:18: hidden$="[[!showNotFoundValue_(menuOptions, pref.value)]]" On 2016/10/25 at 01:02:38, dpapad wrote: > ...
4 years, 1 month ago (2016-10-25 01:13:32 UTC) #5
michaelpg
https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html File chrome/browser/resources/settings/controls/settings_dropdown_menu.html (right): https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html#newcode18 chrome/browser/resources/settings/controls/settings_dropdown_menu.html:18: hidden$="[[!showNotFoundValue_(menuOptions, pref.value)]]" On 2016/10/25 01:02:38, dpapad wrote: > showNotFoundValue ...
4 years, 1 month ago (2016-10-25 01:14:37 UTC) #6
dpapad
https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html File chrome/browser/resources/settings/controls/settings_dropdown_menu.html (right): https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html#newcode19 chrome/browser/resources/settings/controls/settings_dropdown_menu.html:19: disabled="[[!showNotFoundValue_(menuOptions, pref.value)]]"> So to avoid calculating the same boolean ...
4 years, 1 month ago (2016-10-25 01:18:09 UTC) #7
dpapad
LGTM with minor nit about not calculating the same boolean twice. https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.js File chrome/browser/resources/settings/controls/settings_dropdown_menu.js (right): ...
4 years, 1 month ago (2016-10-25 01:30:48 UTC) #8
michaelpg
Done in CSS. Thanks! https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html File chrome/browser/resources/settings/controls/settings_dropdown_menu.html (right): https://codereview.chromium.org/2446003002/diff/1/chrome/browser/resources/settings/controls/settings_dropdown_menu.html#newcode19 chrome/browser/resources/settings/controls/settings_dropdown_menu.html:19: disabled="[[!showNotFoundValue_(menuOptions, pref.value)]]"> On 2016/10/25 01:18:09, ...
4 years, 1 month ago (2016-10-26 01:23:10 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2446003002/60001
4 years, 1 month ago (2016-10-26 01:23:39 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clang_dbg_recipe/builds/152692)
4 years, 1 month ago (2016-10-26 02:17:21 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2446003002/60001
4 years, 1 month ago (2016-10-26 02:21:11 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: android_clang_dbg_recipe on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_clang_dbg_recipe/builds/152702)
4 years, 1 month ago (2016-10-26 02:28:24 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2446003002/60001
4 years, 1 month ago (2016-10-26 05:26:54 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/324662)
4 years, 1 month ago (2016-10-26 07:09:03 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2446003002/60001
4 years, 1 month ago (2016-10-26 18:33:31 UTC) #25
commit-bot: I haz the power
Committed patchset #3 (id:60001)
4 years, 1 month ago (2016-10-26 21:14:11 UTC) #27
commit-bot: I haz the power
4 years, 1 month ago (2016-10-26 21:17:48 UTC) #29
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/b02d4b3efb575bb85e49404940a84cc616a48388
Cr-Commit-Position: refs/heads/master@{#427792}

Powered by Google App Engine
This is Rietveld 408576698