Although FormWidget works properly for declarative creation and normal programmatic creation (new MyWidget({...})), setAttribute() after a register.createElement("my-widget") call won't be handled correctly:
var w = register.createElement("my-widget");
w.foo = 123;
w.setAttribute("aria-label", "...");
In this case the setAttribute() call occurs before the focusNode has been created, so presumably the setAttribute() call is a no-op.
The solution is presumably that in that case FormWidget#setAttribute() should just set the attribute on the root node, and then it will be moved to the correct node later, in FormWidget#postRender().
Note that the case below works fine since the DOM structure is created before the new returns:
var w = new MyWidget({ foo: 123 });
w.setAttribute("aria-label", "...");
Although
FormWidget
works properly for declarative creation and normal programmatic creation (new MyWidget({...})
),setAttribute()
after aregister.createElement("my-widget")
call won't be handled correctly:In this case the
setAttribute()
call occurs before thefocusNode
has been created, so presumably thesetAttribute()
call is a no-op.The solution is presumably that in that case
FormWidget#setAttribute()
should just set the attribute on the root node, and then it will be moved to the correct node later, inFormWidget#postRender()
.Note that the case below works fine since the DOM structure is created before the
new
returns: