Skip to content

feat(shortcut): add M key to toggle audio mute (#173)#751

Open
Rucha0901 wants to merge 4 commits into
magic-peach:mainfrom
Rucha0901:feat/mute-shortcut-173
Open

feat(shortcut): add M key to toggle audio mute (#173)#751
Rucha0901 wants to merge 4 commits into
magic-peach:mainfrom
Rucha0901:feat/mute-shortcut-173

Conversation

@Rucha0901
Copy link
Copy Markdown
Contributor

@Rucha0901 Rucha0901 commented May 19, 2026

Summary

Closes #173
Implements the M key as a keyboard shortcut to toggle audio mute/unmute, following standard video player conventions.

Changes

src/hooks/useVideoEditor.ts

  • Added a useEffect that listens for the M key on document and calls setRecipe(prev => ({ ...prev, keepAudio: !prev.keepAudio })).
    • The effect only registers when a file is loaded (if (!file) return) - satisfying the acceptance criterion that the shortcut does nothing without a video.
    • Guards against text-input focus (INPUT, TEXTAREA, contentEditable) and modifier keys (Ctrl, Meta, Alt) to avoid conflicts with OS shortcuts or typed text.
    • Uses a functional setRecipe update - no stale-closure risk and no extra hook dependencies.

src/components/AudioSpeedControl.tsx

  • Removed the previous useEffect keyboard handler from this component (it lacked the file guard).
    • Added a visible M kbd badge on the mute toggle button so users can discover the shortcut at a glance.

src/components/VideoEditor.tsx

  • Added KeyboardShortcutsPanel - a collapsible panel in the right sidebar that documents all keyboard shortcuts:
    • M -> Toggle audio mute
    • Ctrl + Enter -> Export video

Acceptance Criteria

  • M key toggles audio when file is loaded
  • - [x] Doesn't interfere with text input focus
  • - [x] Documented in keyboard shortcuts panel

- Move M-key handler from AudioSpeedControl into useVideoEditor hook
  so the shortcut is guarded by ile (only fires when a video is loaded)
- Protect against text input focus (INPUT, TEXTAREA, contentEditable)
- Also guard against Ctrl/Meta/Alt modifiers to avoid conflicts
- Use setRecipe functional update (no stale-closure risk; no extra deps)
- Add visible M kbd badge on the mute toggle button for discoverability
- Add collapsible KeyboardShortcutsPanel in the right sidebar documenting
  both shortcuts: M (mute) and Ctrl+Enter (export)

Closes magic-peach#173
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@Rucha0901 is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @Rucha0901!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 19, 2026

✅ PR Format Check Passed — @Rucha0901

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions github-actions Bot added the level:intermediate Intermediate level - 35 pts label May 19, 2026
@Rucha0901 Rucha0901 changed the title feat feat(shortcut): add M key to toggle audio mute (#173) May 19, 2026
Rucha0901 added 3 commits May 20, 2026 07:53
- VideoEditor.tsx: remove role='list' from <ul> (jsx-a11y/no-redundant-roles)
  ul already has an implicit list role; the explicit attribute is redundant
- useVideoEditor.ts: add loopMusic, musicFile, musicVolume, originalAudioVolume
  to handleExport dependency array (react-hooks/exhaustive-deps)
Upstream added normalizeAudio: boolean as a required second param to
buildAudioFilter. Update all test call sites to pass false (no normalization),
and add a new test case verifying the loudnorm filter is appended when
normalizeAudio is true.

Also fix stray '++' syntax corruption in presets.ts introduced during merge.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Intermediate level - 35 pts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Accessibility] Add keyboard shortcut for toggling audio mute (M key)

1 participant