Shortcuts/hotkey from within an input element?

I’ve been dabbling in Bubble for over a year, but this is my first post.

My app will have an aspect to it that will require a bit of rote data entry. I’m trying to figure out the best way to handle shortcuts and hotkey from within input elements.

Example: Tab into a search input and begin typing, focus group opens as search matches populate into the search and autocorrect plug-in, press “down arrow” to select down the repeating group, when I get to the one I want, press “enter” to fire a work flow that selects…
I have many other ideas for different inputs, but the behavior needs to be specific to the input that is focused.

I am very close to achieving this using Air Keyboard Shortcut Plugin. I set it to global so that it fires from inputs. I then use another plugin called Keystroke Input Trigger Plugin to only fire the workflow if the input monitor’s “currently typing is ‘yes’” on a specific input.
The problem is that keystroke trigger gets stuck in a “detecting input” state when you tab out of the input. I’ve emailed the developer, but not sure what to expect with a free plugin. In case that turns out to be a dead end, I thought I’d reach out to see how others handle this?

If I could get an “input is focused” condition option in a workflow, that might work, but that option is not offered.

Does anyone have any clever ideas of how to do this? Would it be worthwhile to learn JS and use Toolbox or something else to get this kind of granular control (not even sure if that would do it).

Would love to hear some ideas! Thanks!

It’s available to create a workflow based on when an input’s value is changed - would that help?

Thanks for the suggestion care1. That condition evaluates after exiting the input. I need a way to sense if an input is focused at the workflow level so that shortcuts will only exert certain behaviors when an input is focused.

The way the Air Keyboard Shortcut plugin works is you define within the plugin element placed on the page, a keypress or combination of keypresses that will set off a trigger, let’s say “down” (the down arrow). Then I can create a workflow to fire when the trigger is detected. When the “global” option is not checked it won’t fire if an input is focused, which makes sense if you don’t want specific behaviors responding while inputting text. But if you “allow globally” the trigger will fire even when an input is focused. I’m looking for a way to detect the focus of specific inputs to assign specific reactions to those inputs when focused, but then not fire once the input is exited.

Is there maybe a different plugin I should try?

You explained that really well.

Like most things in bubble, there are probably multiple ways to do it. Finding the least resource intensive is always nice. (Aside: I wonder why input focus isn’t available as a condition to trigger a workflow, directly.)

You could create a condition for a hidden “middle-man” element on the page to react based upon the inputs focus. You could then trigger the workflow based on that changed condition.

For example: create a group, 0x0 pixels. In the properties box of that object, uncheck the “visible on page load”. Then create a condition that it’s visible if input A is focused. You can then create the workflow - When (that group) is visible, do this etc.

I’m not sure if that will apply to your specific needs, and obviously is a little odd you have to do this to achieve what you want. I’m always looking for the elegant solution and this doesn’t feel like one, lol.

Care1, this is a great suggestion. I have seen others hint at something like it in other posts, but I must have been too fixated on trying to make my idea work that I ignored the simplicity of this. One downside is I was hoping to use the ‘enter’ key to trigger a workflow to match functionality that’s familiar from other software and websites. Using this method, ‘enter’ will cause the input to lose focus before the AirKeyBoardShorcut Plugin can capture it and check for focus. But… I have decided to use the right arrow key for now, and it works great! Sometimes it’s best to find a close enough solution and move on. Maybe I can hire someone later to fix the input monitor plugin, but for now, I’d rather not get bogged down. Thanks again for this idea! I’m going to use it!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.