diff --git a/packages/ui/components/form-core/src/FocusMixin.js b/packages/ui/components/form-core/src/FocusMixin.js index 54aaf735d..a1102cdaf 100644 --- a/packages/ui/components/form-core/src/FocusMixin.js +++ b/packages/ui/components/form-core/src/FocusMixin.js @@ -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(); } } diff --git a/packages/ui/components/form-core/types/FocusMixinTypes.ts b/packages/ui/components/form-core/types/FocusMixinTypes.ts index 11d79aa36..3f3445c9e 100644 --- a/packages/ui/components/form-core/types/FocusMixinTypes.ts +++ b/packages/ui/components/form-core/types/FocusMixinTypes.ts @@ -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