SketchUp shortcuts with WebDialog open

Hi devs!
Is there a way to make SketchUp shortcuts work when WebDialog is open?

In SketchUp 2016 if I have focus on my plugin WebDialog shortcuts are not working but if I click the SketchUp main window (where the model is build) they work.
Is there a quick way to propagate the shortcuts thru webdialog?

Thank you!

  • Andrei

does your WD need focus?

some more details of what it does could help answer your query…


Andrei, correct me if I am wrong, but from your description it sounds like the opposite situation from what John describes. Namely, when the WD has focus it receives all keyboard input, including keys that you have set as shortcuts in SketchUp. You are asking for clues about javascript and ruby code that would propagate those keys through to SketchUp? I’ll let more expert voices chime it, but I don’t think this is possible without reimplementing the actions of the shortcuts in ruby. Shortcuts are a feature of the SketchUp GUI, which is inactive when a WD has focus or ruby is running.

In the original v16 there was a bug where the webdialogs were loosing focus to SU. This was very annoying when SU was firing away (short-cut) commands when you were inputting some text fields in the webdialog. The only way to fix that was adding a ‘focus’ command in javascript.

So, maybe you can add some ‘blur’ and ‘focus’ commands to your javascript to make it work?!

my question should have probably been expand on as I refer to the same scenario as you…

does your WD need focus to receive Key events itself?
i.e. does it require ‘text input’ or rely on it’s own ‘Shortcut keys’?

If not, it is possible to create a WebDialog that never holds focus if it’s not required, i.e. similar to the ‘Instructor’ dialog…

click events can be manipulated to function, but WD mouseover and key events can’t…

these use to work on a OS X, but not to my knowledge on Windows…

my current ‘cross platform’ workaround is to run a second dummy webDialog…


My WD comunicates with nodejs server, if WD receives a message I lose focus from SketchUp and the shortcuts are not working until I click again on SketchUp.

I think I found the issue, after every message received by WD I resize it which cause change of focus.
The fix will be to set focus to SketchUp after WD resize.