Skip to content

Commit 005069f

Browse files
committed
fix(card): parent-href preventing CM variation from working
1 parent c737e81 commit 005069f

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

packages/web-components/src/components/card/card-footer.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license
33
*
4-
* Copyright IBM Corp. 2020, 2024
4+
* Copyright IBM Corp. 2020, 2025
55
*
66
* This source code is licensed under the Apache-2.0 license found in the
77
* LICENSE file in the root directory of this source tree.
@@ -45,6 +45,18 @@ class C4DCardFooter extends C4DLinkWithIcon {
4545
return Boolean(parentHref) && (!href || parentHref === href);
4646
}
4747

48+
/**
49+
* Contact Module won't work if card-footer has parent-href attribute
50+
* this function removes parent-href if the cta type is 'chat' or 'contact'
51+
*/
52+
protected _cleanParentHrefForContactModule() {
53+
const { ctaType } = this;
54+
55+
if (ctaType === 'chat' || ctaType === 'contact') {
56+
this.removeAttribute('parent-href');
57+
}
58+
}
59+
4860
/**
4961
* Handles `slotchange` event on the default `<slot>`.
5062
*/
@@ -134,6 +146,8 @@ class C4DCardFooter extends C4DLinkWithIcon {
134146
if (iconInline) {
135147
targetNode!.classList.add(`${prefix}--link-with-icon--inline-icon`);
136148
}
149+
150+
this._cleanParentHrefForContactModule();
137151
}
138152

139153
static get stableSelector() {

packages/web-components/src/components/cta/defs.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license
33
*
4-
* Copyright IBM Corp. 2020, 2023
4+
* Copyright IBM Corp. 2020, 2025
55
*
66
* This source code is licensed under the Apache-2.0 license found in the
77
* LICENSE file in the root directory of this source tree.
@@ -101,6 +101,11 @@ export enum CTA_TYPE {
101101
*/
102102
CHAT = 'chat',
103103

104+
/**
105+
* Another CTA variation with a chat icon, whose action opens the chat widget.
106+
*/
107+
CONTACT = 'contact',
108+
104109
/**
105110
* CTA with a phone icon, whose action opens default telephony app.
106111
*/

0 commit comments

Comments
 (0)