Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add current-checked attribute to checkable form controls #5326

Merged
merged 15 commits into from
Oct 28, 2021

Conversation

nicholasrice
Copy link
Contributor

@nicholasrice nicholasrice commented Oct 26, 2021

Pull Request

πŸ“– Description

This PR is a follow-up to #5298 to support checked state mutability through HTML attributes.

It adds a new TypeScript mixin, CheckableFormAssociated, to consolidate business logic of checkable controls into one centralized location. It then adds the currentChecked property/attribute into that mixin, and integrates the mixin into the Checkbox, Radio, and Switch components.

This PR also adjusts the implementation of the formResetCallback and formResetCallback to be class methods instead of functions assigned during construction. The (HTML spec)[https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-api] requires these lifecycle methods to exist on the prototype in order to be invoked appropriately by the browser, so the implementation we had for these methods was incorrect and they were never being invoked directly by the browser.

🎫 Issues

πŸ‘©β€πŸ’» Reviewer Notes

πŸ“‘ Test Plan

βœ… Checklist

General

  • I have included a change request file using $ yarn change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

⏭ Next Steps

…f71d553b.json

Co-authored-by: Jane Chu <7559015+janechu@users.noreply.github.com>
@nicholasrice nicholasrice merged commit e92a16b into master Oct 28, 2021
@nicholasrice nicholasrice deleted the users/nirice/add-current-checked branch October 28, 2021 17:04
nicholasrice added a commit that referenced this pull request Nov 17, 2021
* adding and integrating CheckableFormAssociated

* adding tests

* add comments and cleanup

* fixing callbacks so that they can be superd and invoked by the browser

* Change files

* Delete @microsoft-fast-foundation-23ec31a3-a8eb-42e2-9ad0-c96005a332a7.json

remove un-needed change file

* moving proxy setAttribute to constructor

* add super call to formResetCallback

* re-implementing class-adding bheavior

* remove duplicate code

* Update change/@microsoft-fast-foundation-770324f7-b3b0-46a2-8634-8e57f71d553b.json

Co-authored-by: Jane Chu <7559015+janechu@users.noreply.github.com>

* update API report

Co-authored-by: nicholasrice <nicholasrice@users.noreply.github.com>
Co-authored-by: Jane Chu <7559015+janechu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants