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