Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

82
Vistas
Manually Setting currentTarget with Javascript

I'm consistently having a problem with React / Javascript: often times, I want to anchor something on the close of a modal.

Example

  1. Some modal is triggered, for example, "Would you like to do this or that?", with this and that each being a button.
  2. When the user clicks, this, the modal holding that button closes and causes another DOM element that requires an anchor (in my case, it's a <Popover/> component.

Expected Behavior The popover component is rendered where the this button was clicked, enabling further action from the user.

Observed Behavior The popover component is still rendered, but an error is thrown in the console indicating that the anchor element is undefined.

I know that what's going on here is that the modal with the this and that buttons has now closed, so the Popover has nothing to anchor to. So, I'm wondering if there's an approach that would enable me to close the initial modal with the this and that buttons while still anchoring to the spot where one of the buttons was clicked. That's why I've titled this "manually setting currentTarget", because I'm wondering if there's a way to create this anchor or something like that.

Thanks for your help,

Davis

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda