Feature Request: improve radzenTocItem selection when scrolling in radzenToc #1917

Closed
opened 2026-01-29 18:00:15 +00:00 by claunia · 1 comment
Owner

Originally created by @tharreck on GitHub (Nov 26, 2025).

Is your feature request related to a problem? Please describe.
The toc is always looking at the center of the container to decide which toc item should be selected. In my opinion it's more intuitive when you look at the top or bottom of the container depending on scroll direction.
The same behaviour can be seen in bootstrap scrollspy component and wikipedia.
The current implementation does not allow to select the first section when it is small as it can't be set to the center.

Describe the solution you'd like
When you scroll down/up the TOC could respectively look at the bottom/top of the container to decide which TOC Item to select instead of always looking at the center of the container.
This behaviour looks more intuitive for the users and allows small sections in the start or end to be selected.

Additional context
I will add a pull request. see #2370

Originally created by @tharreck on GitHub (Nov 26, 2025). **Is your feature request related to a problem? Please describe.** The toc is always looking at the center of the container to decide which toc item should be selected. In my opinion it's more intuitive when you look at the top or bottom of the container depending on scroll direction. The same behaviour can be seen in [bootstrap scrollspy component](https://getbootstrap.com/docs/5.0/components/scrollspy/) and wikipedia. The current implementation does not allow to select the first section when it is small as it can't be set to the center. **Describe the solution you'd like** When you scroll down/up the TOC could respectively look at the bottom/top of the container to decide which TOC Item to select instead of always looking at the center of the container. This behaviour looks more intuitive for the users and allows small sections in the start or end to be selected. **Additional context** I will add a pull request. see #2370
Author
Owner

@akorchev commented on GitHub (Nov 26, 2025):

Hi @tharreck ,

I am not sure this would solve the problem as there could be more than one item visible at a time. Always selecting the first one could still be problematic. Especially so if the user clicks to a link within the same page which leads to a scroll.

See my comments here: https://github.com/radzenhq/radzen-blazor/issues/2328 and here: https://github.com/radzenhq/radzen-blazor/pull/2340

Still you can open a pull request with your suggested implementation and we will review if it improves the behavior without breaking the existing one.

@akorchev commented on GitHub (Nov 26, 2025): Hi @tharreck , I am not sure this would solve the problem as there could be more than one item visible at a time. Always selecting the first one could still be problematic. Especially so if the user clicks to a link within the same page which leads to a scroll. See my comments here: https://github.com/radzenhq/radzen-blazor/issues/2328 and here: https://github.com/radzenhq/radzen-blazor/pull/2340 Still you can open a pull request with your suggested implementation and we will review if it improves the behavior without breaking the existing one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1917