Skip to content

Commit ac660ef

Browse files
fix(dashboards): Prevent ESC from blocking confirmation modal dismiss
useHotkeys calls preventDefault before the callback, so when the confirmation modal is open the event gets swallowed before GlobalModal can handle it. Use skipPreventDefault and call preventDefault only when we actually close the slideout.
1 parent 8dd2884 commit ac660ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

static/app/views/dashboards/widgetBuilder/components/widgetBuilderSlideout.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ export function WidgetBuilderSlideout({
240240
useHotkeys([
241241
{
242242
match: 'Escape',
243-
callback: () => {
243+
skipPreventDefault: true,
244+
callback: (evt: KeyboardEvent) => {
244245
if (!isModalVisible) {
246+
evt.preventDefault();
245247
onCloseWithModal();
246248
}
247249
},

0 commit comments

Comments
 (0)