Gravatar for slangevin@coveo.com

Question by Simon, Apr 8, 2016 4:33 PM

Clearing facet brings the focus back to the top of the page

When clearing a facet, the url clears the hash and send the user back to the top of the page. This is the expected behavior, but in the case of a search interface inserted after a long description, the user will have to scroll back down.

A use case is having a coveo-generated product listing page after a technical description of the product category (two or three paragraphs).

Any suggestions on how to keep the user in his/her current position?

This is a Coveo for Sitecore installation using the JS framework V1

1 Reply
Gravatar for olamothe@coveo.com

Answer by olamothe, Apr 11, 2016 10:16 AM

On scroll of the window (it's a standard javascript event), you could detect that the user is scrolled past the description (with jQuery it's pretty easy). Store that value.

Then, you can hook a function on querySuccess. At that point, the results should be rendered.

In that function, you can have a small logic to detect that the scroll position was stored and scroll back to the end of the product description (still using jQuery or just standard javascript)

Ask a question