diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index 0fcdb5773..08b1957e2 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -11,6 +11,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis - Added `click()` method to `sl-checkbox`, `sl-radio`, and `sl-switch` - Fixed a bug in `sl-tooltip` where events weren't properly cleaned up on disconnect - Fixed a bug in `sl-tooltip` where they wouldn't display after toggling `disabled` off and on again [#391](https://github.com/shoelace-style/shoelace/issues/391) +- Fixed a bug in `sl-details` where `show()` and `hide()` would toggle the control when disabled - Fixed incorrect event names for `sl-after-show` and `sl-after-hide` in `sl-details` - Improved a11y for disabled buttons that are rendered as links - Improved a11y for `sl-button-group` diff --git a/src/components/details/details.ts b/src/components/details/details.ts index 0627f8b72..8cb67ef9b 100644 --- a/src/components/details/details.ts +++ b/src/components/details/details.ts @@ -74,7 +74,7 @@ export default class SlDetails extends LitElement { /** Shows the alert. */ show() { // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher - if (this.isVisible) { + if (this.isVisible || this.disabled) { return; } @@ -103,7 +103,7 @@ export default class SlDetails extends LitElement { /** Hides the alert */ hide() { // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher - if (!this.isVisible) { + if (!this.isVisible || this.disabled) { return; }