Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

SwitchControl text now toggles checked state #10468

Closed

Conversation

petemill
Copy link
Member

@petemill petemill commented Aug 14, 2017

The click event will now fire from the label, whether it is to the left, right, or top of the switch element.

This also converts text from <span /> to <label /> for accessibility and more appropriate renderer defaults (the cursor) to convey that clicking the label will toggle the checked state.

Usages this affects:

  • all items in the Brave extension panel (compact and full mode)
  • the Clear Browsing Data model
  • the MessageBox component
  • about:adblock

This is a partial resolution only for #8243 since many usages do not use the built-in switchControl label element but render their own text separately. Changing some of those usages to the switchControl label element causes some minor visual regression which may warrant some discussion. A subsequent PR will address converting these usages, which are not covered by this PR:

  • most switches in all sections of about:preferences
  • case-sensitivity switch in the findPage dialog

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Test Plan:

  • Open the Clear Browsing Data model or the Brave extension panel
  • Verify clicking a switch label causes the checked state to toggle
  • Verify no visual regressions

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

…ed state

Partial resolution for brave#8243 since many usages do not use the built-in text
but render their own text separately. A subsequent commit will address converting these
usages.

This also converts text from span to label for accessbility and more appropriate renderer defaults (the cursor).
@luixxiul luixxiul added this to the 0.21.x (Nightly Channel) milestone Aug 14, 2017
@luixxiul luixxiul added polish Nice to have — usually related to front-end/visual tasks. usability labels Aug 14, 2017
@codecov-io
Copy link

codecov-io commented Aug 14, 2017

Codecov Report

Merging #10468 into master will not change coverage.
The diff coverage is 100%.

@@           Coverage Diff           @@
##           master   #10468   +/-   ##
=======================================
  Coverage   54.01%   54.01%           
=======================================
  Files         244      244           
  Lines       21233    21233           
  Branches     3277     3277           
=======================================
  Hits        11470    11470           
  Misses       9763     9763
Flag Coverage Δ
#unittest 54.01% <100%> (ø) ⬆️
Impacted Files Coverage Δ
app/renderer/components/common/switchControl.js 96.55% <100%> (ø) ⬆️

@luixxiul
Copy link
Contributor

@petemill thanks for your contribution! Is this PR ready for reviews?

@petemill
Copy link
Member Author

@luixxiul yes indeed. Please also look at #10470 if you can and let me know if you want to merge with this one or not.

@petemill
Copy link
Member Author

Closing in favor of rolling up with #10470

@petemill petemill closed this Aug 14, 2017
@luixxiul luixxiul removed this from the 0.21.x (Nightly Channel) milestone Aug 14, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
polish Nice to have — usually related to front-end/visual tasks. usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants