Skip to content

feat: v2 - consolidated esc behavior in editor#2209

Merged
maxy-shpfy merged 1 commit intomasterfrom
05-05-feat_v2_-_consolidated_esc_behavior_in_editor
May 6, 2026
Merged

feat: v2 - consolidated esc behavior in editor#2209
maxy-shpfy merged 1 commit intomasterfrom
05-05-feat_v2_-_consolidated_esc_behavior_in_editor

Conversation

@maxy-shpfy
Copy link
Copy Markdown
Collaborator

@maxy-shpfy maxy-shpfy commented May 5, 2026

Description

Closes https://github.com/Shopify/oasis-frontend/issues/605

Introduces a centralized ESC key handler for the editor (useEditorEscapeShortcut) that consolidates escape behavior into a single, prioritized flow:

  1. If a dialog is open, returns false so Radix's portal handler can close it natively.
  2. Restores the front-most maximized window if one exists.
  3. Otherwise, clears ReactFlow node/edge selection and editor selection state.

The previously scattered ESC handler in useConduitEdgeMode has been removed in favor of this centralized approach.

To support this, several supporting changes were made:

  • useDialog now exposes cancel and stack so consumers can inspect the current dialog stack.
  • ShortcutDefinition.action can now return false to signal that the event should not be consumed (skipping preventDefault and clearPressed), allowing native browser and Radix portal handlers to run.
  • EditorStore gains a hasAnySelection computed property that checks all selection state in one place.
  • WindowStoreImpl gains a getFrontMaximizedWindow() method that returns the top-most maximized window by z-order.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Screen Recording 2026-05-05 at 9.20.01 AM.mov (uploaded via Graphite)

Test Instructions

  1. Open the editor with a pipeline loaded.
  2. Select a node or edge on the canvas — pressing ESC should clear the selection.
  3. Open a dialog — pressing ESC should close the dialog without affecting canvas selection.
  4. Maximize a window panel — pressing ESC should restore it before clearing any selection.
  5. Select a conduit node — pressing ESC should deselect it via the centralized handler.

Additional Comments

The action return value contract (void | false) is a targeted escape hatch for dialog coexistence and is not intended as a general shortcut fallthrough mechanism, as the registry holds at most one handler per key combo.

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

🎩 Preview

A preview build has been created at: 05-05-feat_v2_-_consolidated_esc_behavior_in_editor/fb4cd26

@maxy-shpfy maxy-shpfy marked this pull request as ready for review May 5, 2026 16:21
@maxy-shpfy maxy-shpfy requested a review from a team as a code owner May 5, 2026 16:21
Copy link
Copy Markdown
Collaborator

@camielvs camielvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. only comment I will make is if I have a node selected and I open one of the top menus (e.g. windows) I would expect esc to close the dropdown - currently it closes and dropdown and deselects the node

Comment thread src/routes/v2/pages/Editor/hooks/useEditorEscapeShortcut.ts
Comment thread src/routes/v2/shared/shortcuts/useShortcutListener.ts Outdated
Comment thread src/routes/v2/pages/Editor/hooks/useEditorEscapeShortcut.ts
Comment thread src/routes/v2/pages/Editor/hooks/useEditorEscapeShortcut.ts Outdated
Comment thread src/providers/DialogProvider/hooks/useDialog.test.tsx
@maxy-shpfy maxy-shpfy force-pushed the 05-05-feat_v2_-_consolidated_esc_behavior_in_editor branch from bc6880b to 0f4a672 Compare May 5, 2026 23:54
Copy link
Copy Markdown
Collaborator Author

maxy-shpfy commented May 6, 2026

Merge activity

  • May 6, 12:05 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 6, 12:05 AM UTC: Graphite rebased this pull request as part of a merge.
  • May 6, 12:08 AM UTC: @maxy-shpfy merged this pull request with Graphite.

@maxy-shpfy maxy-shpfy force-pushed the 05-05-feat_v2_-_consolidated_esc_behavior_in_editor branch from 0f4a672 to fb4cd26 Compare May 6, 2026 00:05
@maxy-shpfy maxy-shpfy merged commit e4fcb21 into master May 6, 2026
17 checks passed
@maxy-shpfy maxy-shpfy deleted the 05-05-feat_v2_-_consolidated_esc_behavior_in_editor branch May 6, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants