Skip to content

Commit ceadc0c

Browse files
committed
feat: pathways dropdown closes with a new pathway is selected
1 parent 7c7da6b commit ceadc0c

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

packages/micro-journeys/src/interactive-pathways.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,27 @@ class BoltInteractivePathways extends withLitHtml() {
117117
@click=${() => {
118118
this.showPathway(i);
119119
setTimeout(() => {
120-
this.renderRoot
121-
.querySelector('bolt-micro-journeys-dropdown')
122-
.renderRoot.querySelector('button')
123-
.click();
120+
try {
121+
let boltMicroJourneyDropdown;
122+
let boltMicroJourneyDropdownButton;
123+
boltMicroJourneyDropdown = this.renderRoot
124+
? this.renderRoot.querySelector(
125+
'bolt-micro-journeys-dropdown',
126+
)
127+
: null;
128+
if (boltMicroJourneyDropdown) {
129+
boltMicroJourneyDropdownButton = boltMicroJourneyDropdown.renderRoot
130+
? boltMicroJourneyDropdown.renderRoot.querySelector(
131+
'button',
132+
)
133+
: null;
134+
}
135+
if (boltMicroJourneyDropdownButton) {
136+
boltMicroJourneyDropdownButton.click();
137+
}
138+
} catch {
139+
console.error('Autoclose of micro-journey dropdown failed');
140+
}
124141
});
125142
}}
126143
style=${menuItemTextColor}

0 commit comments

Comments
 (0)