Closed jasongitmail closed 7 months ago
Hey Jason, you should be able to use the asChild
prop and render a link to get the behavior you would expect. You are correct in that the reason it doesn't use it by default as there are a number of use cases for pagination.
An example would be helpful in the docs since this will be a very common need for pagination, but its not clear about how to currently
Describe the feature
My understanding is the pagination element uses
onPageChange()
to programmatically navigate.This creates downsides related to progressive enhancement (links won't work for SSR'd pages when user has JS disabled), SEO (b/c no anchor elements for a crawler to follow), and potentially speed (but I haven't confirmed if SvelteKit preloads destination pages, b/c I decided to keep my custom pagination element for now for the reasons described here).
An alternate approach could be to:
a
elements for the page links.The caveat is that the current callback may be more flexible for something like in-page tables, but you could argue the dev should be updating the URL state and that nudges them in the right direction. Or alternatively,
onPageChange()
could be retained as a fallback if thehref
prop is not specified, although this brings some added implementation complexity.(Will let you transfer the issue to Bits UI if you prefer it to live there.)