From fa1dd72980a1f73c7b682da9290338ad4c81cefe Mon Sep 17 00:00:00 2001 From: emyarod Date: Thu, 9 Nov 2023 12:10:56 -0600 Subject: [PATCH 1/2] fix(tabs): remove overflow button conditional rendering check Co-authored-by: Ariella Gilmore --- .../src/components/tabs/tabs.ts | 65 ++++++++++++------- 1 file changed, 42 insertions(+), 23 deletions(-) diff --git a/packages/carbon-web-components/src/components/tabs/tabs.ts b/packages/carbon-web-components/src/components/tabs/tabs.ts index 1c9b55bfcc1..9a532615a07 100644 --- a/packages/carbon-web-components/src/components/tabs/tabs.ts +++ b/packages/carbon-web-components/src/components/tabs/tabs.ts @@ -310,7 +310,7 @@ export default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) { }; /** - * Cleans-up and creats the intersection observer for the scrolling container. + * Cleans-up and creates the intersection observer for the scrolling container. * * @param [options] The options. * @param [options.create] `true` to create the new intersection observer. @@ -411,14 +411,13 @@ export default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) { } } - render() { + /** + * Render the previous button if tablist is wider than container. + */ + protected renderPreviousButton() { const { _isIntersectionLeftTrackerInContent: isIntersectionLeftTrackerInContent, - _isIntersectionRightTrackerInContent: isIntersectionRightTrackerInContent, - _assistiveStatusText: assistiveStatusText, - _handleSlotchange: handleSlotchange, } = this; - const previousButtonClasses = classMap({ [`${prefix}--tab--overflow-nav-button`]: true, [`${prefix}--tabs__nav-caret-left`]: true, @@ -426,6 +425,28 @@ export default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) { [`${prefix}--tab--overflow-nav-button--hidden`]: isIntersectionLeftTrackerInContent, }); + return html` + + `; + } + + /** + * Render the next button if tablist is wider than container. + */ + protected renderNextButton() { + const { + _isIntersectionRightTrackerInContent: isIntersectionRightTrackerInContent, + } = this; const nextButtonClasses = classMap({ [`${prefix}--tab--overflow-nav-button`]: true, [`${prefix}--tabs__nav-caret-right`]: true, @@ -433,20 +454,29 @@ export default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) { [`${prefix}--tab--overflow-nav-button--hidden`]: isIntersectionRightTrackerInContent, }); - return html` + `; + } + + render() { + const { + _assistiveStatusText: assistiveStatusText, + _handleSlotchange: handleSlotchange, + } = this; + return html` + ${this.renderPreviousButton()}
@@ -458,18 +488,7 @@ export default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) {
- - + ${this.renderNextButton()}
Date: Thu, 9 Nov 2023 12:53:39 -0600 Subject: [PATCH 2/2] fix(tabs): add overflow button render method typedefs Co-authored-by: Ariella Gilmore --- packages/carbon-web-components/src/components/tabs/tabs.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/carbon-web-components/src/components/tabs/tabs.ts b/packages/carbon-web-components/src/components/tabs/tabs.ts index 9a532615a07..18320f948a7 100644 --- a/packages/carbon-web-components/src/components/tabs/tabs.ts +++ b/packages/carbon-web-components/src/components/tabs/tabs.ts @@ -7,7 +7,7 @@ * LICENSE file in the root directory of this source tree. */ -import { html } from 'lit'; +import { TemplateResult, html } from 'lit'; import { property, state, query } from 'lit/decorators.js'; import { classMap } from 'lit/directives/class-map.js'; import { prefix } from '../../globals/settings'; @@ -414,7 +414,7 @@ export default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) { /** * Render the previous button if tablist is wider than container. */ - protected renderPreviousButton() { + protected renderPreviousButton(): TemplateResult | null { const { _isIntersectionLeftTrackerInContent: isIntersectionLeftTrackerInContent, } = this; @@ -443,7 +443,7 @@ export default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) { /** * Render the next button if tablist is wider than container. */ - protected renderNextButton() { + protected renderNextButton(): TemplateResult | null { const { _isIntersectionRightTrackerInContent: isIntersectionRightTrackerInContent, } = this;