Opened 10 years ago
Last modified 10 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 10 years ago by
Owner: | set to Marek Lewandowski |
---|---|
Status: | new → review |
comment:2 Changed 10 years ago by
Status: | review → review_failed |
---|
- Invalid test file name (you can also fix the existing file's name).
- Code style issue https://github.com/cksource/ckeditor-dev/compare/t/12682#diff-3e2d22e50cdc50f77ff35ad7a6adccafR9
- Instead of doing long try-catch-finally (https://github.com/cksource/ckeditor-dev/compare/t/12682#diff-998ab6d4d067349f998fb67224a59702R45) you can just store the returned value, revert and check it after that.
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.
Pushed to t/12682 at dev.