Forum Discussion
thartofylaka
9 days agoCommunity Member
Invalid answer dialogue
Hi all, is there a way to close the Invalid answer dialogue box with the escape key? It keeps creating problems at the accessibility check and it was marked as a possible solution from the testers. Thanks!
1 Reply
Sort By
- SamHillSuper Hero
- First you will need to create a Storyline Number variable called esc.
- Then add the following JavaScript to the MASTER SLIDE of your project (timeline starts trigger).
if(!window.customStorylineHandleEscKey) { window.customStorylineHandleEscKey = function(e) { if (e.key === 'Escape' || e.keyCode === 27) { let num = Number(getVar('esc')) + 1; setVar('esc', num); } } document.addEventListener('keydown', window.customStorylineHandleEscKey); }
- Every time the user selects the ESC key, it will increment the Storyline esc variable by 1. This means you can then trigger any behaviour you would like to based on the esc variable value change, for example, hiding a layer:
Use are your own risk as you will need to determine if this interferes with any other ESC key functionality in the browser.
- First you will need to create a Storyline Number variable called esc.