File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -434,10 +434,7 @@ getRadioButtonSetElement.forEach((radioButton: HTMLInputElement) => {
434
434
dropDownElements . forEach ( ( dropDown ) => {
435
435
// add click event listener to the dropdown parent element
436
436
dropDown . addEventListener ( 'click' , ( e ) => {
437
- // keep dropdown open when a subitem is clicked on
438
437
e . stopPropagation ( ) ;
439
- const target = e . target as HTMLElement ;
440
- if ( ! dropDown . children [ 0 ] . innerHTML . includes ( target . outerHTML ) ) return ;
441
438
442
439
const listElement = dropDown . lastElementChild as HTMLElement ;
443
440
if ( listElement . id === 'showList' ) {
@@ -456,6 +453,11 @@ dropDownElements.forEach((dropDown) => {
456
453
457
454
const listElement = dropDown . lastElementChild as HTMLElement ;
458
455
456
+ // Prevent the click event on subitems from propagating to the parent dropdown
457
+ listElement . addEventListener ( 'click' , ( e ) => {
458
+ e . stopPropagation ( ) ;
459
+ } ) ;
460
+
459
461
// loop through children of dropdown and add event listener to each child
460
462
for ( let i = 0 ; i < listElement . children . length ; i ++ ) {
461
463
const child = listElement . children [ i ] as HTMLElement ;
You can’t perform that action at this time.
0 commit comments