mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-19 18:28:42 +00:00
Add iOS focus element messaging for ha-generic-picker component (#28569)
This commit is contained in:
@@ -9,6 +9,7 @@ import { tinykeys } from "tinykeys";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import type { FuseWeightedKey } from "../resources/fuseMultiTerm";
|
||||
import type { HomeAssistant } from "../types";
|
||||
import { isIosApp } from "../util/is_ios";
|
||||
import "./ha-bottom-sheet";
|
||||
import "./ha-button";
|
||||
import "./ha-combo-box-item";
|
||||
@@ -236,6 +237,7 @@ export class HaGenericPicker extends LitElement {
|
||||
}
|
||||
return html`
|
||||
<ha-picker-combo-box
|
||||
id="combo-box"
|
||||
.hass=${this.hass}
|
||||
.allowCustomValue=${this.allowCustomValue}
|
||||
.label=${this.searchLabel}
|
||||
@@ -284,6 +286,15 @@ export class HaGenericPicker extends LitElement {
|
||||
private _dialogOpened = () => {
|
||||
this._opened = true;
|
||||
requestAnimationFrame(() => {
|
||||
if (this.hass && isIosApp(this.hass)) {
|
||||
this.hass.auth.external!.fireMessage({
|
||||
type: "focus_element",
|
||||
payload: {
|
||||
element_id: "combo-box",
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
this._comboBox?.focus();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -176,6 +176,13 @@ interface EMOutgoingMessageAddEntityTo extends EMMessage {
|
||||
};
|
||||
}
|
||||
|
||||
interface EMOutgoingMessageFocusElement extends EMMessage {
|
||||
type: "focus_element";
|
||||
payload: {
|
||||
element_id: string;
|
||||
};
|
||||
}
|
||||
|
||||
type EMOutgoingMessageWithoutAnswer =
|
||||
| EMMessageResultError
|
||||
| EMMessageResultSuccess
|
||||
@@ -197,7 +204,8 @@ type EMOutgoingMessageWithoutAnswer =
|
||||
| EMOutgoingMessageThreadStoreInPlatformKeychain
|
||||
| EMOutgoingMessageImprovScan
|
||||
| EMOutgoingMessageImprovConfigureDevice
|
||||
| EMOutgoingMessageAddEntityTo;
|
||||
| EMOutgoingMessageAddEntityTo
|
||||
| EMOutgoingMessageFocusElement;
|
||||
|
||||
export interface EMIncomingMessageRestart {
|
||||
id: number;
|
||||
|
||||
Reference in New Issue
Block a user