docsearch icon indicating copy to clipboard operation
docsearch copied to clipboard

Key listener issues in SPA

Open Mister-Hope opened this issue 3 years ago • 13 comments

Hi, this is Mr.Hope from VuePress Team.

Docsearch is not providing a method to destory itself or any way to customize (or remove) the search key listener in docs. So I wonder if there is a way, otherwise this will trigger error in SPA application, as each initialization will have side effects which can not be cleared.

Visit https://mister-hope.com/ and scroll down then click the first article. When you click Ctrl + K, you will find 2 docsearch popup is displayed.

In VuePress, we are using SPA and provide "layout" options, different page may choose different layout. So when you switch to the first article, the whole page is rerendered because they have different layout, so docsearch reinitializes. But the previous key listener seems still exist, so keyboard actions seems not correct.

Mister-Hope avatar Apr 16 '22 04:04 Mister-Hope

Hi, any update with this one? Can we add a detroy method to clear docsearch event listener and destory the dom?

Mister-Hope avatar Sep 25 '22 10:09 Mister-Hope

Hello?

Mister-Hope avatar Dec 27 '22 12:12 Mister-Hope

(Hey there, sorry for the delay, added context here https://github.com/algolia/docsearch/issues/1734)

If you feel like contributing/providing the method, I'd be more than happy to review it!

shortcuts avatar Dec 27 '22 12:12 shortcuts

Sure, I will try to build a destory method if possible.

I just want to make sure if this sounds ok to you before starting contribution.

Mister-Hope avatar Dec 27 '22 14:12 Mister-Hope

Hi, any update about this one? I am still meeting users reporting this frequently.

I opened PR years ago https://github.com/algolia/docsearch/pull/1742, while I am not getting any review.

@shortcuts @francoischalifour

Mister-Hope avatar Mar 05 '24 08:03 Mister-Hope