Skip to content

New scroll-to modifier #259

Open
Open
@ygongdev

Description

@ygongdev

Description
Adding a new scroll-to functional modifier that mimics the native scrollTo.
It is possible that we only want to perform a scroll-to if a certain condition is satisfied, so this modifier will optionally take a boolean to know when to trigger its scroll-to

API
The arguments are chosen to closely mimc the API of the native scrollTo, which supports 2 positional arguments or a named option. We just add one more API to support the optional boolean.

Positional arguments: [top, left, shouldScroll] or scrollOptions
Named arguments: { top, left, behavior, shouldScroll }

Examples
Debating between explicit positional arguments and a single positional object containing the config, which gives more flexibility if the native scrollOptions API happens to change.

<div {{scroll-to 100 100 true}}></div>

vs

<div {{scroll-to scrollOptions true}}></div>

Named

<div {{scroll-to top=this.top left=this.left behavior=this.behavior shouldScroll=this.shouldScroll}}></div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions