Describe the bug
When using the Tabs component, I get a ReferenceError: HTMLButtonElement is not defined error.
This happens when the two conditions meet:
Set Tab#as prop to something besides "button".
Renders the page in SvelteKit ssr mode.
Setting ssr: false in hooks.js (see svelte-kit doc on hooks) can avoid this problem, but there should be a fundamental solution.
Seems like HTMLButtonElement is not defined in ssr mode, and the code is only reached if as is not "button" (default value):
Describe the bug When using the
Tabs
component, I get aReferenceError: HTMLButtonElement is not defined
error. This happens when the two conditions meet:Tab#as
prop to something besides"button"
.Setting
ssr: false
inhooks.js
(see svelte-kit doc on hooks) can avoid this problem, but there should be a fundamental solution.Seems like
HTMLButtonElement
is not defined in ssr mode, and the code is only reached ifas
is not"button"
(default value):https://github.com/rgossiaux/svelte-headlessui/blob/a6c6a8ed238c3fead92982af2215a39e9b7ce3e0/src/lib/utils/resolve-button-type.ts#L2-L12
To Reproduce
Here's a repo with a fresh svelte-kit starter with basic Tabs demo. (index.svelte#L8-19)
Library version
Using
svelte-headlessui@1.0.0