Opened 5 years ago

Last modified 5 years ago

#12682 review_failed New Feature

Add a return value for scrollIntoView

Reported by: Marek Lewandowski Owned by: Marek Lewandowski
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

We should include a boolean value returned by the scrollIntoView method.

If scroll occurred, then true would be returned, false otherwise.

In addition to that it turned out that there are no tests at all for scrollIntoParent and only one for scrollIntoView.

Rationale:

You might need information if the scrolling really occured.

Logic which determinates if scrolling should happen or not, is a part of scrollIntoParent implementation and is not exposed.

I've got into that thing while working on our side project, where in case of scroll we had to do some extra layout repositioning.

Current workaround:

The shortest workaround would be:

var wnd = issue.element.getWindow(),
	initialYScroll = wnd.getScrollPosition().y,
	scrollOccurred;

issue.element.scrollIntoView();

scrollOccurred = wnd.getScrollPosition().y !== initialYScroll;

Somebody might also use scroll event listener to do that, which is even more ugly.

I belive we should introduce it in next major release, since it's an API change.

Change History (2)

comment:1 Changed 5 years ago by Marek Lewandowski

Owner: set to Marek Lewandowski
Status: newreview

Pushed to t/12682 at dev.

comment:2 Changed 5 years ago by Piotrek Koszuliński

Status: reviewreview_failed

Additionally, since these tests check scrollPosition what's very risky, please verify if you didn't do that, that they pass on all IEs when executed from the dashboard as well as directly.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy