0 Replies Latest reply on Feb 21, 2018 11:44 PM by AverinAAA

    HTML Panel document.onfocus/onblur?

    AverinAAA Level 1

      Having this code:

       

      document.onfocus = function(e) {

      console.log("document onfocus " + e)

      }

      document.onblur = function(e) {

      console.log("document onfocus " + e)

      }

      document.querySelector("body").onfocus = function(e) {

      console.log("body onfocus, document hasFocus " + document.hasFocus())

      }

      document.querySelector("body").onblur = function(e) {

      console.log("body onblur, document hasFocus " + document.hasFocus())

      }

       

      I can see that when click on my panel and then I alt-tab from photoshop body looses focus and log message states that document had focus.

      If I just alt-tab – document didn't have focus.

      So document focus state does change.

      The problem is that `document.onfocus/onblur` are never called when focus state changes.

      Why?

       

      My problem:
      I am using Shift modifier key as hotkey in my HTML panel. When panel is not in focus keycode isn't sent to the panel. I understand there is no workaround for keycodes, so I want to display a un-focused state so users would understand that they have to click on the panel to make it focused.

       

       

      Panel would loose focus if you click on another panel, eg. Layers