mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 18:42:45 +08:00
FIX: prevent event propagation when pressing escape key on lightbox (#22924)
When we use the escape key to exit lightbox for images within a chat channel, it also closes the chat drawer due to event bubbling (since both lightbox and chat use an event listener on the escape key). This change prevents event bubbling when using the escape key within lightbox, which means that it will close the lightbox but won't close the chat drawer.
This commit is contained in:
parent
db7581ce49
commit
d8bf926d2d
|
@ -361,6 +361,7 @@ export default class DLightbox extends Component {
|
|||
onKeydown(event) {
|
||||
if (event.key === KEYBOARD_SHORTCUTS.CLOSE) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
return this.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user