Skip to content

fix: cast evt.target to Element in hotkey handler#1998

Merged
willeastcott merged 2 commits intomainfrom
fix/hotkey-event-target-type
Apr 12, 2026
Merged

fix: cast evt.target to Element in hotkey handler#1998
willeastcott merged 2 commits intomainfrom
fix/hotkey-event-target-type

Conversation

@willeastcott
Copy link
Copy Markdown
Contributor

@willeastcott willeastcott commented Apr 12, 2026

Summary

  • Cast evt.target from EventTarget | null to Element | null in the hotkey keydown handler, fixing type errors when accessing tagName and classList

Test plan

  • Verify hotkeys still work in the viewport (e.g. W/E/R for translate/rotate/scale)
  • Verify hotkeys are correctly ignored when typing in input/textarea fields
  • Verify hotkeys work in input fields with the hotkeys class

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 12, 2026

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

Project Deployment Actions Updated (UTC)
editor Ready Ready Preview, Comment Apr 12, 2026 10:26pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the editor’s global hotkey keydown handler to address TypeScript typing around evt.target, so the handler can safely check the focused element before processing hotkeys.

Changes:

  • Introduces a target local variable cast from evt.target to Element | null.
  • Uses target.tagName / target.classList for the “ignore input/textarea unless .hotkeys” early-return check.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/editor/hotkey/hotkey.ts Outdated
@willeastcott willeastcott merged commit fca8371 into main Apr 12, 2026
7 checks passed
@willeastcott willeastcott deleted the fix/hotkey-event-target-type branch April 12, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants