mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Focus alarm control panel PIN input on wider screens (#24324)
* Focus alarm control panel PIN input on wider screens * Also apply on textfield
This commit is contained in:
parent
f84ad92356
commit
cae36b393b
@ -40,8 +40,13 @@ export class DialogEnterCode
|
|||||||
|
|
||||||
@state() private _showClearButton = false;
|
@state() private _showClearButton = false;
|
||||||
|
|
||||||
|
@state() private _narrow = false;
|
||||||
|
|
||||||
public async showDialog(dialogParams: EnterCodeDialogParams): Promise<void> {
|
public async showDialog(dialogParams: EnterCodeDialogParams): Promise<void> {
|
||||||
this._dialogParams = dialogParams;
|
this._dialogParams = dialogParams;
|
||||||
|
this._narrow = matchMedia(
|
||||||
|
"all and (max-width: 450px), all and (max-height: 500px)"
|
||||||
|
).matches;
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +101,7 @@ export class DialogEnterCode
|
|||||||
>
|
>
|
||||||
<ha-textfield
|
<ha-textfield
|
||||||
class="input"
|
class="input"
|
||||||
dialogInitialFocus
|
?dialogInitialFocus=${!this._narrow}
|
||||||
id="code"
|
id="code"
|
||||||
.label=${this.hass.localize("ui.dialogs.enter_code.input_label")}
|
.label=${this.hass.localize("ui.dialogs.enter_code.input_label")}
|
||||||
type="password"
|
type="password"
|
||||||
@ -134,6 +139,7 @@ export class DialogEnterCode
|
|||||||
.label=${this.hass.localize("ui.dialogs.enter_code.input_label")}
|
.label=${this.hass.localize("ui.dialogs.enter_code.input_label")}
|
||||||
type="password"
|
type="password"
|
||||||
inputmode="numeric"
|
inputmode="numeric"
|
||||||
|
?dialogInitialFocus=${!this._narrow}
|
||||||
></ha-textfield>
|
></ha-textfield>
|
||||||
<div class="keypad">
|
<div class="keypad">
|
||||||
${BUTTONS.map((value) =>
|
${BUTTONS.map((value) =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user