add focus to new element
This commit is contained in:
@@ -67,6 +67,7 @@ export class UmbPropertyEditorUIMultipleTextStringElement extends LitElement {
|
||||
private _onAdd() {
|
||||
this._value = [...this._value, { value: '' }];
|
||||
this.dispatchEvent(new UmbPropertyValueChangeEvent());
|
||||
this._focusNewItem();
|
||||
}
|
||||
|
||||
private _onInput(event: UUIInputEvent) {
|
||||
@@ -77,6 +78,13 @@ export class UmbPropertyEditorUIMultipleTextStringElement extends LitElement {
|
||||
this.dispatchEvent(new UmbPropertyValueChangeEvent());
|
||||
}
|
||||
|
||||
private async _focusNewItem() {
|
||||
await this.updateComplete;
|
||||
const inputs = this.shadowRoot?.querySelectorAll('uui-input') as NodeListOf<UUIInputElement>;
|
||||
const lastInput = inputs[inputs.length - 1];
|
||||
lastInput.focus();
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
${this._renderItems()}
|
||||
|
||||
Reference in New Issue
Block a user