Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
Is it possible to call event.stopPropagation after click in mapbox Geocoder?

Hi I am looking a way to stopPropagation on click event after I click on my geocoder component inside mapbox. I try it this way but it is not working. Only one event type which I found works is .on('result' () => {...} ). Is there other way to achieve this ?? Thx.

  const geocoder = new MapboxGeocoder({
    accessToken: mapboxgl.accessToken,
    mapboxgl: mapboxgl,
    language: 'cs'
  });

  geocoder.on('click', (e: any) => {
    console.log('click'); // This never happen
    e.originalEvent.stopPropagation();
  });

  map.addControl(
    geocoder
  );

Edit: Okay so map.addControl add new controls above map. It looks like this enter image description here

There is problem with that becouse I created button on the right side which change colors and do some stuff when you click on it OR you click direct on map. But if you click on searchbar, this event fire also and action which should be fired only when you click direct on map or that button is called.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

From https://github.com/mapbox/mapbox-gl-geocoder/blob/main/API.md#on, the events that the MapboxGeocoder listens for are clear, loading, results, result, error.

Can you say a little more about why you want to stop the on click event / what you are trying to achieve? That answer might suggestion options for implementation

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda