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

116
Views
setting focus on Proxy vue3

I am new to vue3 and working with proxies, and am running into an issues setting focus on a proxy that is passed into my component as a prop.

In the parent component I have:

<Button ref="elementToFocus" @click="handleClickEvent"/>
   
<Modal :isOpen="toggleOpen" :returnFocus="$refs['elementToFocus']" @close="toggleOpen">

And in that Modal component I am accessing elementToFocus in a method that handles closing it:

handleClose() {
            this.$emit('close');
            if( this.returnFocus ) {
              this.returnFocus.focus();
            }
        }

However, I keep getting the error TypeError: this.returnFocus.focus is not a function, I think because this.returnFocus is a Proxy. Do I need to access that element via vanilla JS instead? I'm not if this is an intended use for a proxy. Any help would be much appreciated!

about 4 years ago · Santiago Trujillo
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!