Action for "key pressed" fired everywhere - not just on the focused widget. BUG?

advanced-prototyping

#1

Hi there, hope someone can help.

I am trying to show on a little example how keyboard control in a table works. Everything is set up nicely, header, 6 entries, filter-bar can be turned on / off (no function). Two buttons that are only enabled, if an entry is selected. All entries are in a selection-group.

It works great with the mouse. when given focus with the mouse, the keyboard can also be used to select other entries (with key up and key down).

Now: when I hit “tab”, naturally the next entry would be selected, which I don’t want. I use key up / down for that. With “tab” I want to focus the buttons underneath the table. So each of the six entries has another condition for key pressed, if the key is “tab”, select the first button.

Now my problem: It does not matter where I press “tab”. the first button is ALWAYS selected. focus in the search field? tab jumps to the button. focus on a field in the filter? tab jumps to the button. None of these widgets have a “key pressed” interaction.

This really screams “bug”, but maybe I have done something wrong in my setup. I cut out the part with the table from my original file and changed fonts, colors and texts. So it is not pretty :wink:

Does someone have an idea?

keyboard_troubles.rp (130.9 KB)


#2

It’s not a bug. Realize the browser uses Tab and Shift+Tab to focus widgets to provide an alternate means to access and activate webpage elements, and this is used by screen readers for accessibility.

Axure does allow you to capture the key press prior to the browser handling it, so you can override this. Using a widget’s Key Down is one way, but as you mention, you want this to happen anywhere on the page, regardless of what is in focus. To accomplish this, assign your Key Down events to the page, as in Page Key Down (click anywhere on the page background–not on a widget–to select the page, then look at the INTERACTIONS pane, click on the New Interaction button to find this event. That will enable keyboard keys to be processed anywhere.

Here is a quick demo where I’ve duplicated your Page 1 to Page 2, removed all the Key Down If key pressed equals Tab cases, and created three cases for Page Key Down If key pressed equals Tab, also testing the “text on focused widget” to advance which button gets focused.

keyboard_troubles.rp (221.1 KB)