Skip to main content
Inspiring
April 25, 2017
Answered

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

  • April 25, 2017
  • 1 reply
  • 2187 views

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 has been closed for replies.
    Correct answer sdwarwick

    rather than all of that, try just this:

    $('AudioOff5_btn').focus();

     

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

    1 reply

    Participating Frequently
    April 26, 2017

    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!

    Inspiring
    April 26, 2017

    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.

    Inspiring
    April 26, 2017

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