Skip to content

Commit

Permalink
only call keyboard updated if open prop changes to true
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerwyn committed Jan 8, 2025
1 parent 0ecc49b commit 6e6aaf6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/universal-remote-card.min.js

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions src/classes/keyboards/base-keyboard.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LitElement, css, html } from 'lit';
import { LitElement, PropertyValues, css, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { HomeAssistant, KeyboardPlatform } from '../../models/interfaces';

Expand Down Expand Up @@ -682,13 +682,15 @@ export class BaseKeyboard extends LitElement {
<div class="buttons">${buttons}</div>`;
}

shouldUpdate(changedProperties: PropertyValues) {
return changedProperties.get('open');
}

updated() {
if (this.open) {
waitForElement(this.shadowRoot!, 'textarea').then((textarea) => {
this.textarea = textarea as HTMLTextAreaElement;
this.textarea?.focus();
});
}
waitForElement(this.shadowRoot!, 'textarea').then((textarea) => {
this.textarea = textarea as HTMLTextAreaElement;
this.textarea?.focus();
});
}

static get styles() {
Expand Down

0 comments on commit 6e6aaf6

Please sign in to comment.