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

98
Views
Mantenga el foco dentro del modal mientras está abierto

Quiero mantener el foco dentro del modal con sus respectivos elementos enfocables, estoy trabajando con "WEB COMPONENTS, DOW Y SHADOW DOW"

al intentar realizar este fragmento de código, el enfoque continúa mostrando el error y va a elementos fuera del modal

 private setFocus(): void { const focusableElements = this.querySelectorAll('a[href], button, details, input, select, textarea, [tabindex]:not([tabindex="-1"]), ani-button, ani-textfield'); const firstFocusableElement = focusableElements[0]; const lastFocusableElement = focusableElements[focusableElements.length - 1]; this.addEventListener('keydown', event => { const isTabbed = event.key === 'Tab' || event.code === '9'; if (!isTabbed) { return; } if (event.shiftKey) { if (document.activeElement === firstFocusableElement) { (lastFocusableElement as HTMLElement).focus(); event.preventDefault(); } } else { if (document.activeElement === lastFocusableElement) { (firstFocusableElement as HTMLElement).focus(); event.preventDefault(); } } }); (firstFocusableElement as HTMLElement).focus(); } open(): void { // this.hidden = false; this.setAttribute('visible', 'true'); this.setFocus(); }
about 4 years ago · Juan Pablo Isaza
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!