fast
fast copied to clipboard
rfc: Migrate FormAssociated components to @open-wc/form-control
💬 RFC
@open-wc/form-control
is an open-source library designed to assist authors in writing custom-element form controls. It leverages the ElementInternals platform feature for form-association, and requires a ElementInternals polyfill for browsers that do not support ElementInternals
.
Should FAST refactor its form-component offerings to be built off of @open-wc/form-control
?
🔦 Context
FAST currently uses a proprietary FormAssociated
and FormAssociatedCheckbox
mixin to bring form-association to specific components offered from @microsoft/fast-foundation
. These features work fundamentally differently than @open-wc/form-control
in that they leverage a proxy input element to connect the control to the form for browsers that don't support ElementInternals
. The API surface of FormAssociated
is also not as robust as FormControlMixin
from @open-wc/form-control
and does not offer abstractions for custom constraint validators.
Refactoring @microsoft/fast-foundation
's Form controls to leverage @open-wc/form-control
poses several benefits for FAST:
- Reduces maintenance costs FAST.
- Demonstrates support for the
@open-wc
community. - The API of
FormControlMixin
is more robust and IMO more intuitive for component development. - Does not rely on proxy-element patterns, which add substantial behavioral differences depending on the client.
Risks:
- It requires adding a dependency to
@microsoft/fast-foundation
which comes with the usual dependency risks - Resources dedication to migrating and testing components
References
https://github.com/microsoft/fast/issues/5678#issuecomment-1213573769