Skip to content

Keyboard shortcuts should only fire when the workspace is focused #8202

@semiaddict

Description

@semiaddict

Check for duplicates

  • I have searched for similar issues before opening a new one.

Description

I am using Blockly within a larger application, which also registers keyboard shortcuts.
Blockly shortcuts are handled via a keydown event listener on the document (see https://github.com/google/blockly/blob/master/core/inject.ts#L336).

My application also handles copy-paste shortcuts, but the listeners are added to the element on which the shortcuts are handled.
However, Blockly's shortcuts are also invoked when the workspace is not in focus, interfering with the application's shortcuts.

It seems best to either add Blockly's listener on the workspace's element, or only invoke the shortcuts if the main workspace is focused (see https://github.com/google/blockly/blob/master/core/inject.ts#L307).

Reproduction steps

Stack trace

No response

Screenshots

No response

Browsers

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: bugDescribes why the code or behaviour is wrong

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions