From a67db7e13e7524ba4b834286703fc72347b4271b Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Mon, 15 Mar 2021 13:03:01 -0400 Subject: [PATCH] fix setFocus() method on button --- docs/getting-started/changelog.md | 1 + src/components/button/button.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/changelog.md b/docs/getting-started/changelog.md index 70a665f2..b02e97ab 100644 --- a/docs/getting-started/changelog.md +++ b/docs/getting-started/changelog.md @@ -12,6 +12,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis - Fixed `aria-label` and `aria-labelledby` props in `sl-dialog` and `sl-drawer` - Fixed `tabindex` prop in `sl-menu` - Fixed a bug in `sl-select` where tags would always render as pills +- Fixed a bug in `sl-button` where calling `setFocus()` would throw an error ## 2.0.0-beta.32 diff --git a/src/components/button/button.ts b/src/components/button/button.ts index c1fc320d..019cacac 100644 --- a/src/components/button/button.ts +++ b/src/components/button/button.ts @@ -1,4 +1,4 @@ -import { LitElement, html, internalProperty, property, unsafeCSS } from 'lit-element'; +import { LitElement, html, internalProperty, property, query, unsafeCSS } from 'lit-element'; import { classMap } from 'lit-html/directives/class-map'; import { ifDefined } from 'lit-html/directives/if-defined'; import { event, EventEmitter, tag } from '../../internal/decorators'; @@ -26,7 +26,7 @@ import { hasSlot } from '../../internal/slot'; export default class SlButton extends LitElement { static styles = unsafeCSS(styles); - button: HTMLButtonElement | HTMLLinkElement; + @query('.button') button: HTMLButtonElement | HTMLLinkElement; @internalProperty() private hasFocus = false; @internalProperty() private hasLabel = false;