7 Replies Latest reply on Mar 7, 2017 2:20 AM by Thomas_Szabo

    Passing keyboard presses while panel is active


      Is it possible to pass keyboard/shortcut presses onto Premiere when the panel is active?


      When I click a button on my panel and hit 'spacebar' (to play the timeline) since the panel is active, and not the timeline, I get an error noise. I then have to click back over to the timeline to reactivate the timeline, then hit spacebar to continue playing.


      It would be awesome if when I have the panel active, and press a key, that it passes the key press to premiere to do it's usual thang.

        • 1. Re: Passing keyboard presses while panel is active
          andymees@aje Level 3

          It should work (certainly works for me) ... try telling the button to lose focus after it's clicked eg $(this).blur()

          • 2. Re: Passing keyboard presses while panel is active
            brysonm91110628 Level 1

            I didn't know about .blur(). Thank you, Andy!


            Unfortunately it'll happen when I click any part of the panel, button or not.


            Interesting thing though, when I click the title of the panel (upper left) the panel will still be active, but key presses go through.


            So I must have something that is intercepting key presses. I'm building my panel from the PProPanel sample. How about you?

            • 3. Re: Passing keyboard presses while panel is active
              Thomas_Szabo Level 3

              You need to register for keyboard press events. The panel is not doing it by default (except if you´re typing sth into a textfield). Have you tried the following:


              register_key_events = function() {


                  var keyEventsInterest;

                  var os = 'win';

                  if (os === 'win') {

                      keyEventsInterest = JSON.stringify([

                          {"keyCode": 32} // Spacebar


                  } else {

                      // mac

                      keyEventsInterest = JSON.stringify([

                          {"keyCode": 49} // Spacebar





              • 4. Re: Passing keyboard presses while panel is active
                andymees@aje Level 3

                Hey Thomas


                If I understand it correctly, registering an interest in key events is intended to prevent the registered key event from being sent to the host application. Is that right? I'm pretty green at this and trying to learn. If so, I think Bryson is asking for the opposite.


                In Bryson's case (and in mine as it turns out) ... and with Bruce's PPro panel ... it seems that keyboard presses are not passed to the host application (Premiere) by default. Open the sample PPro Panel, then press the spacebar... does your computer 'beep' back at you, or does the spacebar action get passed to Premiere and thus the application starts/stops sequence playback? On my machine I just hear a 'beep' and the playhead stays put.


                As Bryson describes, if I click anywhere in the panel's title area then 'spacebar' keyboard events are passed to Premiere (which is why I though it was working) ... but if I click anywhere within the body of the panel itself then 'spacebar' keyboard events are apparently intercepted and are not automatically passed to Premiere (although I can capture them with a window keypress listener if necessary and programmatically trigger a play/pause action using ExtendScript).


                I seem to recall there was a change in behaviour with regards to keyboard events and panels a year or so ago (CC2015.1?) and the default behaviour changed such that thereafter the host captured pretty much all key events unless you specifically registered for them (or something like that) ... and then at some later date it seems like that default behaviour changed again (I only surmise this because I had just cobbled together my first attempt at a panel a few days before the 2015.1 update which rather broke it...   and then I discovered it had magically started working again at some later point though I have no idea when). I just started dabbling in panel building again a couple of months ago, so as noted, still very green.


                Not entirely sure what is best practice is at this point.


                Thanks in advance for any wisdom you can offer.


                • 5. Re: Passing keyboard presses while panel is active
                  Thomas_Szabo Level 3

                  I see, yea, I misunderstood the initial question. I think it might be difficult since key strokes are targeted at the active panel. Since none of the host app's own panels is active, I assume it´s technically not easy to bypass key strokes because the question is: where should the keystroke be directed to? To the metadata, sequence or project panel?


                  So if you desire a certain effect to happen like "play the active sequence when space is pressed", then I suggest to register the spacebar in your panel, add a keyboard event listener that handles spacebar presses and execute a function that toggles play/pause of the sequence. Don´t rely on the host app to do the magic for you. Once your panel is active, you´re responsible for what happens with keyboard events - there is no passthrough feature.


                  I hope this helps.


                  2 people found this helpful
                  • 6. Re: Passing keyboard presses while panel is active
                    brysonm91110628 Level 1

                    Thank you Thomas,


                    Basically I'd like to have the panel handle keyboard events the same way other Premiere panels handle keyboard events, by passing them through to the active sequence.


                    Here is a video of what I'm trying to get at.


                    • 7. Re: Passing keyboard presses while panel is active
                      Thomas_Szabo Level 3

                      Ok I think I already answered your question above: there is no feature that bypasses the keyboard event!


                      Here is what needs to be done in order to make the space work like in other panels:

                      1. register your interest for the spacebar key event. See the code that I posted in answer #3.


                      2. next you need to check whether the host is Premiere or After Effects:

                      var host_env = JSON.parse(window.__adobe_cep__.getHostEnvironment());

                      var ppro = host_env.appId === "PPRO" || host_env.appName === "PPRO";

                      var aeft = this.host_env.appId === "AEFT" || this.host_env.appName === "AEFT";


                      3. listen for keyboard press events

                      <body onkeydown="keyDownInBody">


                      4. create a function that handles the event

                      function keyDownInBody(event) {

                           var key_code = evt.keyCode; // returns an integer number representation of the pressed key

                           // check if it's win or mac

                           // check if key_code === spacebar

                           if (ppro) {

                                // toggle active sequence. you need to do some hackery to figure out if it´s currently playing


                                var seq = qe.project.getActiveSequence();

                                if (seq) {




                           else if (aeft) {

                                // toggle active comp



                      That´s basically it.