Skip to content

Add an event argument to onAction #897

Closed

Description

@Haojen

My Raycast Version: latest version (1.28.0)

1. if I bind custom keyboard , The first and second keyboard modifiers in ActionPanel always is enter and cmd + enter,they never change, this is bug ? or that's it ?

Screen Shot 2022-02-14 at 3 13 44 PM

I don' find from https://developers.raycast.com/api-reference/keyboard any details can tell me why it is that.

2. I want when onAction event handler triggered to know user pressed which key, because I want to have different logic for different keys

Here is example

 <ActionPanel.Item
     title="Down"
     shortcut={{ modifiers: ["opt"], key: "arrowDown" }}
     onAction={ keyboardEvent => console.log("Your event triggered by", keyboardEvent.keys, keyboardEvent.modifiers )}
 />

Activity

  1. added
    api
    bug
    on Feb 14, 2022
  2. mathieudutour commented on Feb 24, 2022

    @mathieudutour
    Member

    if I bind custom keyboard , The first and second keyboard modifiers in ActionPanel always is enter and cmd + enter,they never change, this is bug ? or that's it ?

    That's a feature ;)
    The first and second action are always going to have those 2 shortcuts, that's what users are used to. The behaviour is documented here: https://developers.raycast.com/api-reference/user-interface/action-panel#actionpanel

    The shortcut that you define will still work tho

    I want when onAction event handler triggered to know user pressed which key, because I want to have different logic for different keys

    I'm not too sure that would lead to a good UX. What would be the use case for it?

  3. added
    feature request
    and removed
    bug
    on Feb 24, 2022
  4. changed the title [-]ActionPanel Keyboard API 2 Questions[/-] [+]Add an event argument to `onAction`[/+] on Feb 24, 2022
  5. mathieudutour commented on Apr 19, 2022

    @mathieudutour
    Member

    Going to close this as it's unlikely that we are going to do this without details about the use cases

  6. added a commit that references this issue on Sep 11, 2025
  7. added a commit that references this issue on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apifeature request

    Type

    No type

    Fields

    Priority

    None yet

    Severity

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions