Select to view content in your preferred language

Disable Tooltip on Search Component

58
3
4 hours ago
SebastianKrings
Frequent Contributor

Hi,

there is a tooltip on the input which simply shows the previous placeholder/watermark.
Its gone, after typing any input.

I would like to disable this tooltip at all.

SebastianKrings_0-1779297631326.png

In case the locator is enabled as single source its gone and replaced by a locator message.
This shouldn't be disabled.

SebastianKrings_1-1779297708837.png

Seen on the sample here:
https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-search/

BTW:
Why dont you put samples into the docs any more as we were used to have on the old widget docs.
To be honest, I often am googlin for the widgets doc to get the samples related and their codepens.
Hope this will come back for components as well.

0 Kudos
3 Replies
MatthewDriscoll
MVP Alum

I believe the tool tip comes from the title.  

const search = new Search({
  view: view
});

view.ui.add(search, "top-right");

search.when(() => {
  const input = search.container.querySelector("input");

  if (input) {
    input.removeAttribute("title");
  }
})
0 Kudos
SebastianKrings
Frequent Contributor

Hi,

thanks for reaching out.
Despite youre using old widget, I cannot see any title on the input. Do you?

SebastianKrings_0-1779309388708.png

 

0 Kudos
MatthewDriscoll
MVP Alum

Sorry, not many have moved onto components yet. Try this. 

<arcgis-search
  id="search"
  popup-disabled
></arcgis-search>

 

My guess is the title is now behind the shadow dom.  So you might need to wait until the component is ready.

const search = document.getElementById("search");

search.addEventListener("arcgisReady", () => {

  // access internal input inside shadow DOM
  const input = search.shadowRoot?.querySelector("input");

  // remove browser tooltip
  input?.removeAttribute("title");

});
0 Kudos