Skip to content

Any key pressed trigger doesn't work #217

@idkhow2type

Description

@idkhow2type

Issue

new Trigger(Trigger.KEY_PRESSED, { key: "any" }, this.whenKeyAnyPressed) doesn't run this.whenKeyAnyPressed

Fix

Add this._onKeyDown('any'); to _keydown method, i.e:

private _keydown(e: KeyboardEvent): void {
  e.preventDefault();

  const key = this._getKeyName(e);
  if (this.keys.indexOf(key) === -1) {
    this.keys.push(key);
  }

  this._onKeyDown(key);
  this._onKeyDown('any');
}

(Should I make a pull request? This is my first time contributing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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