fix(form-core) use updated over attributeChangedCallback

This commit is contained in:
Sciurus7 2023-04-17 16:42:48 +02:00
parent 2683a73080
commit 251de2c84e
2 changed files with 5 additions and 14 deletions

View file

@ -48,6 +48,7 @@ const FocusMixinImplementation = superclass =>
* @type {boolean} * @type {boolean}
*/ */
this.focusedVisible = false; this.focusedVisible = false;
this.autofocus = false;
} }
connectedCallback() { connectedCallback() {
@ -62,15 +63,11 @@ const FocusMixinImplementation = superclass =>
} }
/** /**
* Gets called when an attribute is changed. * @param {import('lit').PropertyValues } changedProperties
* @param {String} name
* @param {String | null} _old
* @param {String | null} value
* @protected
*/ */
attributeChangedCallback(name, _old, value) { updated(changedProperties) {
super.attributeChangedCallback(name, _old, value); super.updated(changedProperties);
if (name === 'autofocus') { if (changedProperties.has('autofocus')) {
this.__syncAutofocusToFocusableElement(); this.__syncAutofocusToFocusableElement();
} }
} }

View file

@ -25,12 +25,6 @@ export declare class FocusHost {
*/ */
blur(): void; blur(): void;
/**
* Synchronizes property values when attributes change.
* @category attributes
*/
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
/** /**
* The focusable element: * The focusable element:
* could be an input, textarea, select, button or any other element with tabindex > -1 * could be an input, textarea, select, button or any other element with tabindex > -1