underctrl-io / commandkit

Only focus on what matters - Let CommandKit handle your commands and events in your Discord.js projects!
https://commandkit.js.org
MIT License
86 stars 11 forks source link

Search bar not working on docs website #6

Closed Firgrep closed 11 months ago

Firgrep commented 12 months ago

Really smooth transition between pages on your docs website - very cool! But I notice the search bar isn't working. Just opens a gray box when you click it.

notunderctrl commented 12 months ago

Interesting. I can't seem to get the same issue. Here's what I get: image

Can you check your network tab for any failed requests? This is what it looks like for me: image

Firgrep commented 12 months ago

So when I open the site in a new window (incognito just to be sure), and I click the search bar, it opens up as expected with the little white box inside the gray one. Screenshot 2023-09-09 14 18 52

But as soon as I click to enter the docs and try the search bar again, a non-interactive gray box opens. Screenshot 2023-09-09 14 21 01

I suspect this is something to do with the ViewTransitions. I think I heard somewhere that it may turn off javascript and that you have to do something extra in order to re-enable it. E.g. https://youtu.be/lsXqparnx24?si=ayV0NVg5OD6JpBSc&t=135 he says you have to add transition:persist to the HTML element and any state attached to it. I'm sure there is more info about this.

notunderctrl commented 12 months ago

I can confirm this does happen after a page switch, although I'm not sure why. As far as I can tell,transition:persist can only be used with HTML elements. I've opened a support thread in the Astro Discord to see if it's possible to use a layout for all the markdown content. Hopefully this can make it easier to ensure that the JavaScript for the search functionality is executed on every page load.

notunderctrl commented 11 months ago

The docs are now using Next.js, marking this issue solved.

Firgrep commented 11 months ago

Interesting choice! Looks very cool. I've also been trying out Nextra with a project I'm working on. Best of luck!

notunderctrl commented 11 months ago

Nextra is definitely more production ready. I think you'll love it