Skip to content

Commit d2ce7eb

Browse files
committed
v1.5.0 - don't close dialog elements with ESC key
1 parent d40ce02 commit d2ce7eb

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

clicky-menus.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Clicky Menus v1.4.0
2+
* Clicky Menus v1.5.0
33
*/
44

55
/**

clicky-menus.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Clicky Menus v1.4.0
2+
* Clicky Menus v1.5.0
33
*/
44

55
( function() {
@@ -67,11 +67,11 @@
6767
if ( null !== e.target.closest( 'ul[aria-hidden="false"]' ) ) {
6868
currentMenuItem.focus();
6969
toggleSubmenu( currentMenuItem );
70-
e.stopPropagation();
70+
e.preventDefault();
7171
// we're on a parent item
7272
} else if ( 'true' === e.target.getAttribute( 'aria-expanded' ) ) {
7373
toggleSubmenu( currentMenuItem );
74-
e.stopPropagation();
74+
e.preventDefault();
7575
}
7676
}
7777
}
@@ -105,7 +105,7 @@
105105

106106
// bind event listener to button
107107
button.addEventListener( 'click', toggleOnMenuClick );
108-
menu.addEventListener( 'keyup', closeOnEscKey );
108+
menu.addEventListener( 'keydown', closeOnEscKey );
109109
}
110110
} );
111111
}

readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Clicky Menus
22

3-
Version 1.4.0
3+
Version 1.5.0
44

55
Jump to: [About](#about), [Features](#features), [Setup & Configuration](#setup--configuration), [Browser Support](#browser-support) [Changelog](#changelog)
66

@@ -157,6 +157,10 @@ Internet Explorer 11 support is possible if you include polyfills for [`closest`
157157
158158
## Changelog
159159
160+
### 1.5.0 (May 27, 2025)
161+
162+
- Change `ESC` key event handler to fire on `keydown` instead of `keyup` and use `.preventDefault()` instead of `.stopPropogation()` when focus is inside a submenu or parent of open submenu. This will prevent the `ESC` key from closing `dialog` elements when a clicky-menu is inside one.
163+
160164
### 1.4.0 (April 29, 2025)
161165
162166
- Further differentiate automatically-generated submenu IDs by including a unique ID for each clicky-menu.

0 commit comments

Comments
 (0)