Docs
Place the search / Page signals for themes

Page signals for themes

Once a shopper has used the search, the page says how many answer tabs are open, so your theme can react.

2 min readPlugin 0.47.13

What the page tells you#

Each search opens an answer tab, like a browser tab. PXL Search publishes how many are open, in two ways, so your theme can react, for example by hiding its own hint while answers are showing:

  • The attribute data-pxl-search-tabs on the <html> element holds the number of open tabs.
  • The event pxl-search:tabs fires on window each time it changes. Its detail is that number.
CSS and JavaScript
/* set on <html> */
html[data-pxl-search-tabs="0"] .my-hint { display: block; }

// fired on window, detail = number of open tabs
window.addEventListener("pxl-search:tabs", e => console.log(e.detail));

Typing examples stop#

The example searches that type themselves into a search bar or a marked field stop while answer tabs are open. See The navbar field.

Was this page helpful?