Skip to content

Add keyboard shortcut (Space) for Play/Pause to improve accessibility #4986

@yogibytes

Description

@yogibytes

Current Behavior

Currently, Play/Pause in Music Blocks is mainly controlled through mouse-based interaction.
There is no keyboard shortcut (such as the Space key) available to quickly toggle Play/Pause, which can slow down iteration and limit accessibility for users who prefer or rely on keyboard navigation.


Desired Behavior

Allow users to toggle Play/Pause using the Space key as a keyboard shortcut.

The shortcut should:

  • Toggle Play/Pause when Space is pressed
  • Not trigger when focus is inside text inputs or editable fields
  • Preserve all existing behavior without breaking current interactions

Screenshots / Mockups

Not applicable. This request focuses on keyboard interaction rather than visual UI changes.


Implementation

A global keydown listener can be added to detect the Space key and toggle Play/Pause when appropriate.

Considerations:

  • Ignore key events when focus is on text input or editable elements
  • Avoid conflicts with existing shortcuts
  • Keep the implementation minimal and well-documented

The approach can be adjusted based on maintainer feedback or project conventions.


Acceptance Tests

  • Pressing Space toggles Play/Pause when the workspace is focused
  • Pressing Space does not trigger Play/Pause when typing in text inputs
  • Existing mouse-based controls continue to work as before
  • No unintended side effects or shortcut conflicts occur

Environment

  • Operating System: Windows
  • Browser: Chrome
  • Version of Software/Project: Latest (master branch)

Additional Information

This enhancement follows common conventions used in music and media tools and may improve accessibility and workflow efficiency, particularly for keyboard-focused users.

I would be happy to work on implementing this if it aligns with the project goals.


Checklist

  • I have read and followed the project's code of conduct.
  • I have searched for similar issues before creating this one.
  • I have provided all the necessary information to understand and reproduce the issue.
  • I am willing to contribute to the resolution of this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions