Skip to main content
Tushar3
Jun 6, 2022 10:35 PM UTC
Solved

How does one handle undo action?

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.

This topic has been closed for replies.
tank666
tank666Solution
Jun 7, 2022 1:20 PM UTC

From ui.html:

window.top.focus();
// Or
window.parent.parent.focus();
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank

3 replies

tank666
tank666Solution
Jun 7, 2022 1:20 PM UTC

From ui.html:

window.top.focus();
// Or
window.parent.parent.focus();
UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
marz_gallery
Jul 14, 2024 5:03 AM UTC

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

tank666
Jul 14, 2024 5:41 AM UTC

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.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank