Skip to content

Bug: Keybindings match too broadly #7434

@etrepum

Description

@etrepum

Lexical version: all

Steps to reproduce:

  1. Focus the playground
  2. Issue a keyboard shortcut with modifiers that overlap with but do not match exactly the intended shortcut for an existing listener (e.g. Shift+Cmd+K when the existing listener is intended for Cmd+K).

The current behavior

Lexical matches Shift+Cmd+K as Cmd+K because it does not check all modifiers when doing keyboard shortcut matching

The expected behavior

Built-in keyboard shortcuts should exactly match the intended keyboard shortcut, and not handle it if other modifiers are also pressed

Impact of fix

The built-in command listeners for keyboard presses can unintentionally preventDefault and do something else when native behavior is intended

Originally posted by @etrepum in #7412 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreReconciler, DOM, Selection, Node, Events, Compositiongood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions