feat(dashboards): Add ESC key to dismiss widget builder slideout#112186
Merged
NicoHinderling merged 5 commits intomasterfrom Apr 7, 2026
Merged
feat(dashboards): Add ESC key to dismiss widget builder slideout#112186NicoHinderling merged 5 commits intomasterfrom
NicoHinderling merged 5 commits intomasterfrom
Conversation
Pressing Escape while the widget builder slideout is open now triggers the same close flow as the Close button, including the unsaved-changes confirmation modal when edits are pending. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The document-level keydown listener for Escape fired even when the confirmation modal was open, causing it to immediately reopen after being dismissed — trapping the user in a loop. Check global modal visibility and defaultPrevented before triggering the close handler. Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
scttcper
reviewed
Apr 3, 2026
| }); | ||
| }, [initialState, onClose, state]); | ||
|
|
||
| useEffect(() => { |
Member
There was a problem hiding this comment.
probably copy what we're doing here https://github.com/getsentry/sentry/blob/master/static/app/components/globalDrawer/index.tsx#L187-L196
Replace raw useEffect + addEventListener with the useHotkeys hook from @sentry/scraps/hotkey, matching the pattern used by the global drawer. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The useHotkeys refactor accidentally removed useEffect from the React import while it's still used elsewhere in the component, causing a ReferenceError crash when opening the widget builder. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8dd2884. Configure here.
scttcper
approved these changes
Apr 7, 2026
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.
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
…2186) Pressing Escape while the widget builder slideout is open now triggers the same close flow as the Close button. If there are unsaved changes, the confirmation modal appears; otherwise the panel closes immediately. Previously there was no keyboard shortcut to dismiss the slideout — you had to click the Close or Cancel buttons. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 <noreply@example.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pressing Escape while the widget builder slideout is open now triggers the same close flow as the Close button. If there are unsaved changes, the confirmation modal appears; otherwise the panel closes immediately.
Previously there was no keyboard shortcut to dismiss the slideout — you had to click the Close or Cancel buttons.