Skip to main content
Solved

How does one handle undo action?


Tushar3

How do I shift the focus from the plugin over to the app after I’ve executed some actions on the document through the plugin? I want to avoid having to click on the document every time I have to undo. Currently the focus still stays on the plugin after I’ve clicked a button in it - hence “command + z” doesn’t work.

Best answer by tank666

From ui.html:

window.top.focus();
// Or
window.parent.parent.focus();
View original
This topic has been closed for comments

3 replies

tank666
  • 4868 replies
  • Answer
  • June 7, 2022

From ui.html:

window.top.focus();
// Or
window.parent.parent.focus();

marz_gallery

i just meet the same problem can you explain more detail how to use that code?


tank666
  • 4868 replies
  • July 14, 2024

There is nothing complicated in the code above. These lines shift focus to the window in which Figma’s native shortcuts work. That is, call any of these lines immediately after interacting with your plugin’s UI so that the user can use standard shortcuts.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings