Gravatar for jigisha.dhawan@analog.com

Question by jigisha.dhawan, Nov 9, 2018 3:29 AM

Tooltip for facets

Is there any data attribute available which can be used to update the tooltip that is being displayed for Facets?

Gravatar for jigisha.dhawan@analog.com

Comment by jigisha.dhawan, Nov 9, 2018 2:10 PM

Hello

We have some abbreviations listed as facet titles. To make them more clear for the end user we wanted to see if the tooltip can be used to display a short description about the facet field that is being displayed

2 Replies
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Nov 9, 2018 10:34 AM

I do not think there is a data attribute for that. The tooltip is always equal to the facet title or facet value text.

Gravatar for jigisha.dhawan@analog.com

Comment by jigisha.dhawan, Nov 9, 2018 11:49 AM

Hello

Thanks for the reply

What will be the best way to customize the display for tooltip?

Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Nov 9, 2018 2:50 PM

You could change the tooltips with JavaScript code after the initialization of the Coveo JavaScript Search Framework.

Coveo.$$(Coveo.$$(document).find('#coveo03e10c6f')).on('afterInitialization', function () {
  var newTooltip = 'Custom Text';
  var facetTitleElement = Coveo.$$(document).find('#facetCategory .coveo-facet-header-title');
  facetTitleElement.setAttribute('aria-label', newTooltip);
  facetTitleElement.setAttribute('title', newTooltip);
});

The above code assumes a CoveoSearchInterface component with a specific ID (coveo03e10c6f). Change it for your own ID. It also assumes a CoveoFacet component with a specific ID (facetCategory). Change it for your own ID.

This code does not take care of translation in multiple languages. If you serve your search interface in more than one language, you would have to customize the code to translate your tooltips.

Gravatar for jigisha.dhawan@analog.com

Comment by jigisha.dhawan, Nov 9, 2018 3:28 PM

Thanks for this. I will give this a try!!

Ask a question