clients icon indicating copy to clipboard operation
clients copied to clipboard

[PS-1872] remember me label triggers toggle

Open jcuenca95 opened this issue 2 years ago • 6 comments

Type of change

- [x] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Response to issue #3945 "Remember email" checkbox label isn't clickable Clicking on the label of "Remember email" checkbox now toggles the checkbox

Code changes

Added a member function to toggle the checkbox and call it on label click This functions just call setValue on the rememberMe formControl with negated value.

  • file.ext: Description of what was changed and why

Screenshots

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

jcuenca95 avatar Nov 11 '22 21:11 jcuenca95

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 11 '22 21:11 CLAassistant

Thank you for your contribution! We've added this to our internal Community PR board for review. ID: PS-1872

bitwarden-bot avatar Nov 11 '22 21:11 bitwarden-bot

It’s a workaround rather than a proper fix. Check the accessibility guidelines, checkbox’s labels should have a proper for attribute.

fromaline avatar Nov 17 '22 22:11 fromaline

Hi @djsmith85 thanks for the comments. I've updated the changes using the bitCheckbox as you say. I'm happy to help and open to new comments.

jcuenca95 avatar Dec 09 '22 13:12 jcuenca95

CheckboxModule needs to be imported in the LoginModule for the directive to be applied. However I've noticed an issue where the directive styles don't get applied properly due to CSP. I'm looking into it

coroiu avatar Dec 13 '22 07:12 coroiu

Fix can be found here: https://github.com/bitwarden/clients/pull/4219 . After that PR gets merged bitCheckbox should work as expected! The directive should contain all visual css rules, so we should be able to remove class="tw-w-4 tw-rounded tw-border" as well.

Also, if possible, please consider using bit-form-control as it is used in the default story linked by Daniel above.

  <bit-form-control>
    <input type="checkbox" bitCheckbox formControlName="checkbox" />
    <bit-label>Click me</bit-label>
  </bit-form-control>

note: This might add some margin below the checkbox, feel free to adjust it on the bit-form-control.

coroiu avatar Dec 13 '22 15:12 coroiu

@jcuenca95 Received approval from QA and this is ready to merge 🎉

djsmith85 avatar Jan 17 '23 15:01 djsmith85

@djsmith85 Great! Thanks for the patience 😊😊

jcuenca95 avatar Jan 17 '23 15:01 jcuenca95