Skip to content

feat: extend Delete key to single hotspots, sticky notes, and screen groups#1

Merged
trmquang93 merged 3 commits intomainfrom
feature/delete-key-all-objects
Mar 15, 2026
Merged

feat: extend Delete key to single hotspots, sticky notes, and screen groups#1
trmquang93 merged 3 commits intomainfrom
feature/delete-key-all-objects

Conversation

@trmquang93
Copy link
Copy Markdown
Collaborator

Summary

  • Single hotspot delete: clicking a hotspot selects it (hotspotInteraction.mode === "selected"); pressing Delete/Backspace now removes it
  • Sticky note delete: clicking a note selects it (with glow ring visual feedback); Delete removes it
  • Screen group delete: clicking the group label selects it (solid border replaces dashed); Delete removes it
  • Selection state: adds selectedStickyNote and selectedScreenGroup state with cross-clearing — selecting any object deselects all others; canvas clicks and Escape also clear the new selections
  • Priority order preserved: batch hotspots → single hotspot → connection → sticky note → screen group → screen

Files changed

File Change
src/Drawd.jsx Add 2 new state vars, wire selected/onSelect props, pass new props to hooks
src/components/StickyNote.jsx Accept selected/onSelect; call onSelect on mousedown; show glow ring when selected
src/components/ScreenGroup.jsx Accept selected/onSelect; call onSelect on label mousedown; solid border when selected
src/hooks/useKeyboardShortcuts.js Add single hotspot, sticky note, screen group delete cases; Escape clears new selections
src/hooks/useCanvasMouseHandlers.js Clear sticky note and screen group selections on canvas click
src/hooks/useKeyboardShortcuts.test.js 17 new tests (new behaviors, priority ordering, guards, regressions)

Test plan

  • Click a single hotspot → press Delete → hotspot removed
  • Click a sticky note → press Delete → note removed
  • Click a screen group label → press Delete → group removed
  • Verify visual selection: glow on sticky note, solid border on screen group
  • Selecting one type clears others (no double-selection)
  • Click empty canvas → all selections cleared
  • Escape clears sticky note / screen group selection
  • Existing behaviors unchanged: batch hotspots, connections, screens
  • Delete blocked when typing in an input/textarea or a modal is open
  • npm test — 229 tests passing, 0 failures

…groups

Delete/Backspace now handles all selectable canvas objects:
- Single selected hotspot (hotspotInteraction.mode === "selected")
- Selected sticky note
- Selected screen group

Adds selection state (selectedStickyNote, selectedScreenGroup) with
visual feedback — glow ring on sticky notes, solid border on screen
groups — and cross-selection clearing so only one object type is
selected at a time. Canvas clicks and Escape also clear the new
selections. Priority order: batch hotspots > single hotspot >
connection > sticky note > screen group > screen.

Adds 17 tests in useKeyboardShortcuts.test.js covering new behaviors,
priority ordering, Backspace parity, and existing regression cases.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flow-forge Error Error Mar 15, 2026 0:41am

…e-key feature

Resolves conflicts by keeping both feature sets:
- Multi-select props (isMultiSelected, onToggleSelect, onMultiDragStart) for StickyNote
- Rubber-band canvas selection with clearSelection/startRubberBand
- Individual delete support (deleteHotspot, selectedStickyNote, selectedScreenGroup) preserved
- Merged dependency arrays in useKeyboardShortcuts to cover both feature sets
@trmquang93 trmquang93 merged commit fab051c into main Mar 15, 2026
1 of 2 checks passed
@trmquang93 trmquang93 deleted the feature/delete-key-all-objects branch March 15, 2026 00:41
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.

1 participant