Gravatar for

Question by simonbyrne, Feb 2, 2015 7:32 AM

Preventing focus


We're experiencing a problem with Coveo stealing focus, especially in Chrome.

When you are on a page that has a Coveo form on it, and you manually type in a new URL in the browser's URL bar and press enter, the Coveo form things you are starting a new query. So instead of going to the new URL, you go to a new Coveo search result.

I see this problem is evident on Coveo's own Developer portal, so I don't think it's a problem with our implementation.

So my question is about how I use the "autoFocus" option to set 'false'. The documentation on this is extremely patchy, so I would really appreciate it if somebody could tell me what I'm doing wrong…

Current code (not working):

Coveo.$(function () {
    Coveo.$('#@Model.SearchBoxUniqueId').coveo('initSearchBox', '@Model.GetSearchPageUrl()', {
        autoFocus: false

Many thanks.

1 Reply
Gravatar for

Answer by Vincent Séguin, Feb 2, 2015 7:47 AM


According to , you can simply set "data-auto-focus="false"" on the search box. This can also be added on the element with the class "CoveoSearchBox".

Thank you.

Gravatar for

Comment by simonbyrne, Feb 2, 2015 3:34 PM

Thanks so much, @Vincent. This worked out great.

Ask a question