Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScrollLink scrollt naar boven, zelfs als href="#somewhere-else" #2728

Open
Robbert opened this issue Feb 17, 2025 · 0 comments
Open

ScrollLink scrollt naar boven, zelfs als href="#somewhere-else" #2728

Robbert opened this issue Feb 17, 2025 · 0 comments
Labels
bug Something isn't working component/scroll-link

Comments

@Robbert
Copy link
Member

Robbert commented Feb 17, 2025

Met ...restProps is het mogelijk (en de bedoeling) om href te kunnen aanpassen van de default #top.

https://github.com/nl-design-system/utrecht/blob/main/packages/component-library-react/src/ScrollLink.tsx#L9-L27

Ideeën in pseudo code:

  • { href = '#top' } zou misschien duidelijker aangeven dat het bedoeld is als aanpasbare property
  • scrollen optioneel maken if (href === '#' || href === '#top') scrollToTop()
  • fragmentIdentifier = parseUrlAndGetFragment(href) en document.getElementById(fragmentIdentifier).scrollIntoView()
@Robbert Robbert added bug Something isn't working component/scroll-link labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component/scroll-link
Projects
None yet
Development

No branches or pull requests

1 participant