Hotkeys

  • 1
  • Problem
  • Updated 4 years ago
  • Solved
Hotkeys before Superbank allowed for all Hotkeys to work at the same time. For example, I have a Hotkey on a popup that saves and closes the popup that was CTRL S and I also have a button on the main page that was save that was CTRL S. When you pressed CTRL S on the popup, it would save as well as close the popup. Now if you press CTRL S with the popup open, only the button on the main page is triggered and the popup does not close. I could add the close topmost popup onto the main page button to achieve this same thing, but then the save button will not grey out once the model has saved because it will be a multi-action button rather than just a save button.
Photo of Nate Gilbertson

Nate Gilbertson

  • 1,194 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Official Response
Nate, 

We are working on some changes to Hotkey behavior which should make it in to the next patch release, to be released sometime next week.

How the changes will affect you is as follows:

The behavior you are experiencing now, with the Superbank release is a bug that was introduced as we were working to prevent the unintended behavior you were making use of :) pre-Superbank --- we realized that there are just too many issues with allowing multiple Hotkey actions bound to the same keystroke combination to be executedat the same time, so we decided to close this "loophole". However, that does not mean that you cannot have the same keystroke defined multiple places on a page --- it just means that at any one time "there can only be one" button / component whose Hotkey action is allowed to "win" and be run.

With the upcoming release, there are 2 key considerations for implementing Hotkeys that will allow you to have the same keystroke combination defined on multiple buttons / components:

1. Pages are dynamic, so buttons / components with Hotkeys on them are very likely going to be hidden / shown dynamically as a response to user interactions and conditional rendering, so Skuid will never try to execute a Hotkey action associated to a "hidden / invisible" button / component. A component is only visible / shown if it is currently attached to the DOM and is not hidden via the CSS display or visible style attributes. So, if you have the same keystroke bound to two buttons, but one is visible and the other is hidden, that's fine, because Skuid will execute the keystroke bound to the visible button, but not to the invisible button. 


2. Popups --- Popups provide a concept of "priority" that Skuid can take into account when determining which Hotkey actions to run. When a Popup is shown, we consider any buttons / components in that Popup to have a "higher priority" than buttons / components below the Popup. So in your case, if you have a Ctrl + S action bound to a Popup button, and also have Ctrl+S bound to a button behind / below the Popup, the Popup's Ctrl+S action will be considered "higher priority" and will be executed, while the button behind the Popup will not have its action run. But, when the Popup is closed, there will now only be one Ctrl+S action defined, and so the button behind the Popup will be allowed to run. Furthermore, if there are multiple Popups, the topmost Popup will always be considered "highest priority".

So what does this mean for you, Nate?

We'll give you early access to this patch release so you can install it and then make the necessary changes. What you'll need to change is to add the Save action logic to the button in the Popup, rather than relying on the button behind the Popup being simultaneously run when the user clicks Ctrl+S.