mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
fix escape key in dialog/drawer; closes #1457
This commit is contained in:
@@ -132,7 +132,7 @@ export default class SlDialog extends ShoelaceElement {
|
||||
}
|
||||
|
||||
private handleDocumentKeyDown = (event: KeyboardEvent) => {
|
||||
if (this.open && event.key === 'Escape') {
|
||||
if (event.key === 'Escape' && this.modal.isActive() && this.open) {
|
||||
event.stopPropagation();
|
||||
this.requestClose('keyboard');
|
||||
}
|
||||
|
||||
@@ -151,8 +151,8 @@ export default class SlDrawer extends ShoelaceElement {
|
||||
}
|
||||
|
||||
private handleDocumentKeyDown = (event: KeyboardEvent) => {
|
||||
if (this.open && !this.contained && event.key === 'Escape') {
|
||||
event.stopPropagation();
|
||||
if (event.key === 'Escape' && this.modal.isActive() && this.open && !this.contained) {
|
||||
event.stopImmediatePropagation();
|
||||
this.requestClose('keyboard');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user