lwc
lwc copied to clipboard
[Pivots] Support form-associate custom element (FACE) callbacks
Description
As seen in Polymer's implementation, pivots (#2724) should support FACE callbacks such as formAssociatedCallback
and formDisabledCallback
.
This issue has been linked to a new work item: W-11585205
I started implementing this, but there is an interesting wrinkle: FACE assumes you add static formAssociated = true
to your custom element class, similar to how static observedAttributes
work.
So you only get one chance to make an element form-associated. This is a problem if we have class A which is registered first and not form-associated, and then class B which is registered second and is form-associated. A few possibilities:
- Set
static formAssociated = true
for everyPivotCtor
, just in case someone wants to be form-associated. If the callback is invoked by the browser on a non-form-associated element, just ignore it. - Avoid setting
static formAssociated = true
for class A, and then implement some kind of polyfill for class B.
Both options make me nervous. FWIW Polymer's polyfill seems to go for option #1 but not bother to ignore FACE callbacks for non-FACE elements.
At this point name collision should not be a thing... so we should be fine to use formAssociated if the Ctor has it at the time of declaration of the upgradable class.
Pivots were dropped in #3310
@rwaldron do we need this in locker?