Skip to content

Commit a691769

Browse files
committed
fix(with-without): remove accordion/markup coupling, style for no meta-stage=INITIAL
1 parent 9a9d73e commit a691769

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

packages/components/bolt-with-without/js/accordion.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ const handleBlockTitleMobileAccordionClick = async e => {
1616
const targetIsTitle = e.target.classList.contains('c-pega-wwo__block-title');
1717
const targetIsToggler = targetIsIcon || targetIsTitle;
1818
const isMobile = window.matchMedia(mediaQuery).matches;
19-
19+
2020
if (!targetIsToggler || !isMobile) {
2121
return;
2222
}
2323

24-
// @TODO remove tight coupling between markup structure and this.
25-
const parentBlock =
26-
e.target.parentElement.parentElement.parentElement.parentElement;
24+
// @TODO `closest()` may not be polyfilled/transpiled on IE.
25+
const parentBlock = e.target.closest('.c-pega-wwo__block');
2726
const targetIsExpanded = parentBlock.classList.contains(expandedClass);
2827
if (targetIsExpanded) {
2928
parentBlock.classList.remove(expandedClass);

packages/components/bolt-with-without/with-without.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ bolt-animate {
772772
display: block;
773773
overflow: hidden;
774774

775-
&[meta-stage="INITIAL"] {
775+
&:not([meta-stage]) {
776776
max-height: 0;
777777
}
778778

@@ -781,9 +781,6 @@ bolt-animate {
781781
overflow: visible;
782782
}
783783
}
784-
785-
&.c-pega-wwo__block-expanded .c-pega-wwo__block-contents {
786-
}
787784
}
788785
}
789786
&-result {

0 commit comments

Comments
 (0)