Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
Set focus in Figma plugin programmatically

I'm wondering on how to set the focus of the browser into the opened plugin window of a Figma plugin. I'm running React in this plugin.

Tried different approaches so far but does anyone know on how to do it the right way?

For context: I want to react on keyboard inputs and don't want the user first have to click into the plugin window for the keyboard inputs to work. There is no input element involved as I want to get the keyboard events for shortcuts.

Thanks in advance!!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I had to solve a similar problem, and noticed that the "Iconify" plugin does do this.

If you're in React, you can probably get this done with a useRef and a useEffect(() => inputRef.focus()).

You can see the way it was done in Svelte, here. But similar rules apply for React or other UI framework.


    // Focus
    let inputRef: HTMLElement;
    let mounted = false;
    onMount(() => {
        mounted = true;
        if (autofocus) {
            inputRef.focus();
        }
    });

</script>
...

        <input
            type="text"
            title={title ? title : placeholder}
            bind:value
            on:input={handleInput}
            on:blur={handleBlur}
            spellcheck={false}
            autocomplete="off"
            autocorrect="off"
            autocapitalize="off"
            inputmode={type === 'number' ? 'decimal' : 'text'}
            {disabled}
            bind:this={inputRef} />

https://github.com/iconify/iconify-figma/blob/cf9362ea53a30ff1e023bba9bb6dadcd4af6067e/src/icon-finder/components/ui/Input.svelte#L104-L112

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!