Skip to content

Add margin to ScrollIntoViewOptions #2730

@davidbukacek

Description

@davidbukacek

Alignment to the edge of the element may not always be fully desirable. Therefore, it would be good if we could affect the position by specific margin.

Margin would work on a similar principle as rootMargin of the IntersectionObserver method (https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin)

Possible use

element.scrollIntoView({block: 'end', inline: 'end' margin: '0 10px 0 10px'});
element.scrollIntoView({block: 'start', inline: 'start', margin: '50% 0 50%'});

Specification: https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions