Open Maybells opened 10 months ago
The target element might be located beyond the visible area, making it impossible to jump directly (such as when it's in a sliver). That's why scrollToAnchor
must works incrementally, gradually bringing the target into view before executing the final scroll action to reach it.
Use case
My current project is using this library to render very long html files (5000+ elements). This works fine when the user is manually scrolling through the page, but is an issue when they click an anchor link. The widget attempts to smoothly scroll to its destination, but the size of the content makes the transition sloppy and slow.
Proposal
I think it would be useful if the HtmlWidget had a jumpToAnchor(String id) method to go along with its scrollToAnchor(String id) method, like how ScrollController has both jumpTo() and animateTo() methods. Alternatively, it could be a setting in the constructor (something like "anchorBehavior: AnchorBehavior.jump" or "animateAnchors: false".