Skip to main content
Inspiring
Apr 25, 2017 8:44 PM UTC
Answered

Javascript code to set Keyboard focus on a particular element in Captivate?

Is there a JavaScript code that I can execute that will keep keyboard focus on a button after activation? The problem I am having is that when using a screen reader sometimes when I select a button, like a custom Mute button, in Captivate the keyboard focus will revert back to the overall slide and not stay on the button that was selected. 

    This topic is closed to new replies. Start a new post to keep the conversation going.
    sdwarwickCorrect answer
    Participating Frequently
    Apr 27, 2017 2:14 PM UTC

    rather than all of that, try just this:

    $('AudioOff5_btn').focus();

     

    you win points for trying to come up with the right answer first :-) 

    9 replies

    Participating Frequently
    Apr 26, 2017 4:06 PM UTC

    it depends on how the custom mute button was implemented.   if you can put it in the code,  a simple  $('#divid').focus()  will do it!

    Translate
    Inspiring
    Apr 26, 2017 6:12 PM UTC

    I have two custom image buttons for the Mute function with the following labels and advanced actions

    AudioOff5_btn

              Assign cpCmndMute with 0

              Hide AudioOff5_btn

              Show AudioOn5_btn

    AudioOn5_btn

              Assign cpCmndMute with 1

              Hide AudioOn5_btn

              Show AudioOff5_btn

    So would adding an Execute JavaScript onto the advanced action of each button do the trick? Something like

         Execute JavaScript  Script_Window parent

         window.parent = function () {

             document.getElementById('AudioOff5_btn').focus();

        }

    I am a complete novice when it comes to HTML5 and JavaScript so any advice at all would be appreciated.

    Translate
    Inspiring
    Apr 26, 2017 6:17 PM UTC

    Opps. I mean AudioOff has the cpCmndMute with 1 and AudioOn has cpCmndMute with 0.

    Translate