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

View file

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