Skip to content
Snippets Groups Projects

navigation-3415785-Add-listener-to-close-dropdown.

Merged Ahsan Nazir requested to merge issue/navigation-3415785:3415785-add-ability-to into 1.x
1 file
+ 8
0
Compare changes
  • Side-by-side
  • Inline
+ 8
0
@@ -37,6 +37,14 @@
e.currentTarget.getAttribute('aria-expanded') === 'false',
);
});
// Event listener to close dropdown when clicking outside
document.addEventListener('click', (e) => {
const isButtonClicked = trigger.contains(e.target);
if (!isButtonClicked) {
trigger.setAttribute('aria-expanded', 'false');
}
});
},
);
},
Loading