Fix regressions for search inputs with focus scrollable changes (#51484)

This commit is contained in:
Aidan Timson
2026-04-09 10:51:43 +01:00
committed by GitHub
parent cf1fb7751f
commit 5ac6906943
2 changed files with 17 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ import { styleMap } from "lit/directives/style-map";
import memoizeOne from "memoize-one";
import { STRINGS_SEPARATOR_DOT } from "../../common/const";
import { restoreScroll } from "../../common/decorators/restore-scroll";
import { deepActiveElement } from "../../common/dom/deep-active-element";
import { fireEvent } from "../../common/dom/fire_event";
import type {
HASSDomCurrentTargetEvent,
@@ -265,11 +266,13 @@ export class HaDataTable extends LitElement {
this.style.removeProperty("--table-row-width");
}
const activeElement = deepActiveElement();
if (
changedProps.has("selectable") ||
(!this.autoHeight &&
document.activeElement &&
AUTO_FOCUS_ALLOWED_ACTIVE_TAGS.includes(document.activeElement.tagName))
activeElement &&
AUTO_FOCUS_ALLOWED_ACTIVE_TAGS.includes(activeElement.tagName))
) {
this._focusScroller();
}

View File

@@ -16,6 +16,7 @@ import { navigate } from "../../../common/navigate";
import { caseInsensitiveStringCompare } from "../../../common/string/compare";
import { extractSearchParam } from "../../../common/url/search-params";
import { nextRender } from "../../../common/util/render-status";
import { deepActiveElement } from "../../../common/dom/deep-active-element";
import "../../../components/ha-button";
import "../../../components/ha-checkbox";
import "../../../components/ha-dropdown";
@@ -428,6 +429,17 @@ class HaConfigIntegrationsDashboard extends KeyboardShortcutMixin(
}
if (this.configEntries && this.configEntriesInProgress) {
const activeElement = deepActiveElement();
if (
activeElement instanceof HTMLInputElement ||
activeElement instanceof HTMLTextAreaElement ||
activeElement instanceof HTMLSelectElement ||
(activeElement as HTMLElement | null)?.isContentEditable
) {
return;
}
this._tabsSubpage?.focusContentScroller();
}
}