[MD settings] add action-target option to toggle button

Desktop / Chromium - Dave Schuyler [chromium.org] - 9 August 2017 17:24 EDT

This CL adds an optional action-target property for toggle buttons so that another (e.g. parent) element can be the tap target for the toggle. This is useful in the settings-box row elements, so that the whole row is clickable (which is the intended UX design). A couple toggle buttons were also changed to use action-target as examples and proof of concept, but this CL is not intended to change all toggle buttons to use action-target. The unchanged toggle-buttons serve as proof that action-target is optional.

Also, now firing change when the action-target (e.g. the toggle label text) is tapped. The toggle label didn't previously fire a change on tap.

Bug: 734275 Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation Change-Id: Iacf424754a7d47ea299c780a935bd22aa76f75dc Reviewed-on: https://chromium-review.googlesource.com/602668 Commit-Queue: Dave Schuyler

661285b [MD settings] add action-target option to toggle button
.../settings/appearance_page/appearance_page.html | 8 ++-
.../settings/appearance_page/appearance_page.js | 8 ---
.../settings/controls/settings_toggle_button.html | 4 +-
.../settings/controls/settings_toggle_button.js | 55 ++++++++++++++-
.../settings/languages_page/languages_page.html | 4 +-
.../settings/category_default_setting_tests.js | 14 ++--
.../webui/settings/google_assistant_page_test.js | 4 +-
.../data/webui/settings/languages_page_tests.js | 9 ++-
.../webui/settings/settings_toggle_button_tests.js | 79 +++++++++++++++-------
9 files changed, 131 insertions(+), 54 deletions(-)

Upstream: git.chromium.org


  • Share