From 226c856b1ed965acc14ff2e6bd9fa0d0b12d4ab9 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Thu, 23 Feb 2023 10:12:36 -0500 Subject: [PATCH] update scroll controls when adding tabs; fixes #1208 --- docs/resources/changelog.md | 1 + src/components/tab-group/tab-group.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index 53d988f0..851eef37 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -10,6 +10,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Fixed a bug in `` that caused the display label to render incorrectly in Chrome after form validation [#1197](https://github.com/shoelace-style/shoelace/discussions/1197) - Fixed a bug in `` that prevented users from applying their own value for `autocapitalize`, `autocomplete`, and `autocorrect` when using `type="password` [#1205](https://github.com/shoelace-style/shoelace/issues/1205) +- Fixed a bug in `` that prevented scroll controls from showing when dynamically adding tabs [#1208](https://github.com/shoelace-style/shoelace/issues/1208) When using `` the default value for `autocapitalize`, `autocomplete`, and `autocorrect` may be affected due to the bug fixed in [#1205](https://github.com/shoelace-style/shoelace/issues/1205). For any affected users, setting these attributes to `off` will restore the previous behavior. diff --git a/src/components/tab-group/tab-group.ts b/src/components/tab-group/tab-group.ts index 85152cd9..0ec05357 100644 --- a/src/components/tab-group/tab-group.ts +++ b/src/components/tab-group/tab-group.ts @@ -316,6 +316,9 @@ export default class SlTabGroup extends ShoelaceElement { this.tabs = this.getAllTabs({ includeDisabled: false }); this.panels = this.getAllPanels(); this.syncIndicator(); + + // After updating, show or hide scroll controls as needed + this.updateComplete.then(() => this.updateScrollControls()); } @watch('noScrollControls', { waitUntilFirstUpdate: true })