Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.58 KB

File metadata and controls

42 lines (31 loc) · 1.58 KB

API Documentation

SelectionInView

Mixin which scrolls a container to ensure that a newly-selected item is visible to the user.

When the selected item in a list-like component changes, it's easier for the to confirm that the selection has changed to an appropriate item if the user can actually see that item.

This mixin expects a selectedItem property to be set when the selection changes. You can supply that yourself, or use the ItemsSelection mixin.

Kind: global class

selectionInView.scrollItemIntoView(item)

Scroll the given element completely into view, minimizing the degree of scrolling performed.

Blink has a scrollIntoViewIfNeeded() function that does something similar, but unfortunately it's non-standard, and in any event often ends up scrolling more than is absolutely necessary.

Kind: instance method of SelectionInView

Param Type Description
item HTMLElement the item to scroll into view.

selectionInView.scrollTarget : HTMLElement

The element that should be scrolled to bring an item into view.

The default value of this property is the element itself.

Kind: instance property of SelectionInView