Trigger event on focus

Feb 14, 2018


I'm quite familiar with triggering events when a control loses focus or when a user clicks an object, but I'm curious to know if anyone's found a way to trigger an event when a control gains focus - either via a mouse click or key press (tab).


22 Replies
Greg Hagar

Hi Wendy,

Thanks for the response - that is about half of what I'm asking, but not quite the whole of it. :)

I understand how to trigger actions when an object is clicked on, but what I'm looking to do is trigger an action when the user presses the tab key to move to the next object on the slide.

Imagine an input form where the user moves from field to field by pressing the tab key.  To simulate this in SL, I would create a "text entry" object to represent each of the form fields and set the tab order of those text entry fields to match the flow of the form.

As the user moves through the form, I would provide feedback on their input (by checking it against the variable associated with each text entry field. Typically, I do this using a "when control loses focus" trigger on the field being validated, and that's all good.

In this case I need to do something subtly different - I don't want to validate the user input as soon as the current field loses focus, I want to validate it when the next field on the form gains focus.  If the user is only using the mouse to move to the next field, this isn't a problem, because as you've demonstrated, I can just use the "when user clicks" trigger. Where I get stuck with this is if the user tabs to the next field - there is no equivalent of the "when user clicks" trigger for an object that gains focus via tab order. 

I've added a very simplified example of what I'm describing to the file you shared. I've attached it to this post.

Thanks again for your help and attention!


Greg Hagar

Hi Phil, great point about accessibility - what I'm describing would be quite helpful from that perspective!

I assumed what I was hoping to do wasn't really possible yet, but I thought I'd see what community had to say just in case - they've certainly provided some fantastic insight in the past (and will in the future I'm sure)!  

Fiona Macelli

I believe that what Greg was looking for was something to activate the trigger without selecting the object (using the keyboard or otherwise), just having it be "in focus" via the tab key.  That is what I'm looking for anyway.

I wouldn't exactly call it a critical feature, since for accessibility reasons you would not normally want to have something new appear onscreen without the user having done something explicitly to cause the change. But it would be helpful in my current project to have something like this in order to make a particular activity accessible.  And from what I understand of Greg's thread, it would be useful for simulating a form-entry.

I have been able to get satisfactory results using the 'key press' trigger and setting the key to be pressed as the 'tab' key.  It doesn't trigger quite when I want it to, and it doesn't work in reverse order (when tabbing backwards through the tab order). Assigning both tab and shift to activate the trigger on key-press doesn't seem to be accepted even though the trigger panel does let me enter the key combination.

All this is to say: thanks for the suggestion Leslie, but it doesn't meet my current need; it's an uncommon use case and there's lots of other feature requests that would take priority; and if anyone else is trying to do something similar, the key-press trigger has worked the best. 

Leslie McKerchie

Hello Benjamin,

This conversation is a bit dated and we've not released any additional features specific to objects being in focus.

As far as accessibility, we have made improvements to ensure Slide Content Is More Accessible.

Would you be able to further explain what you are working to create and how that relates to accessibility?

Benjamin Weil

Hello Leslie,

Indeed many improvements have been done concerning accessibility and that's great. The feature I was writing about is the fact that you can't customize focus state the way you can customize a hover state (something you can do easily on web sites developpment). It would be a good think to add the possibility to do that in that place (see the screenshot) and in triggers. 

States of an object

Leslie McKerchie

Hi Benjamin,

We do have a new(er) feature regarding the focus indicator. A screen reader will automatically read items in focus, so no trigger is necessary. 

Storyline 360: Two-Color Focus Indicator

In addition, we don't recommend using hover states to display important information since this is not a keyboard-accessible function.

I do fear that I may not be fully understanding what you would like to create. If you could share any further details on your ideal trigger(s) and the action it could create would be helpful. You can share it here or submit it directly to our team as a feature request here.

Benjamin Weil

Hi Leslie, 

I mean that in Articulate you can customize the hover state (when you hover with the mouse), but not the focus state (when someone is navigating with keyboard (through the TAB key)). 

For instance, here is a button I customized: 

Then here is the hover state I customized:

Then here is the focus state (I can't customize it the same way, it only has a colored border):

I would like the focus to be customizable as well in object states, hope you got my point!


Lauren Connelly

Hello Jordan!

We have many javascript experts in the community who I'm sure could share how to configure this using javascript! I hope they'll jump into this discussion to share!

We don't currently have an update to share on this feature. When we do, I'll make sure to share in this thread.

shaton filadelfia

Interested in topic for my current project. When button gains focus, to mimic functionality of hover, would like audio to be triggered that will signify the state conditionally f the button’s state is visited. I have a. inelegant workaround that uses the previous object losing focus and a conditional statement for the button the user will be arriving on. That way they will know from an audible alert the button being read out by reader is complete. A sighted user would experience the button as grayed out. Worried about users going in an order I don’t anticipate (“up” instead of “down”). Thank you. 

Angie Seaman

I have a project where we're collecting information to print into a pdf format, and some of that information is required. It'd be a smoother experience if we could set up a trigger to show the "next" button when the required text entry box loses focus + the variable has any value. 

Is there a way to build a trigger based on focus like this? Today we have it set up with instructions that tell the user to click anywhere outside the entry box when they're done and have a trigger to show the next button if the variable has a value. It works, but it's a little clunky.