Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Support scrolling an element into view #766

Merged
merged 1 commit into from
Apr 22, 2020
Merged

[6.x] Support scrolling an element into view #766

merged 1 commit into from
Apr 22, 2020

Conversation

u01jmg3
Copy link
Contributor

@u01jmg3 u01jmg3 commented Apr 21, 2020

Support scrolling an element into view

Closes #765

@driesvints driesvints changed the title Closes #765 - support scrolling an element into view [6.x] Support scrolling an element into view Apr 21, 2020
@taylorotwell
Copy link
Member

Is there anything actually broken with scrollTo?

@u01jmg3
Copy link
Contributor Author

u01jmg3 commented Apr 21, 2020

No, nothing is broken by using jQuery's scrollTo(). However, using scrollIntoView() is a consistent, well supported method of scrolling to an element and ensuring it is in the current viewport. This is important because it means the element is clickable for further interactions with Dusk. It would also reduce the need for jQuery if that's ever something you wanted to consider.

(For reference, an article from 2014 although still relevant: https://luxiyalu.com/difference-between-scrolls/)

@taylorotwell
Copy link
Member

So, if it is going to do the same thing as scrollTo is there some reason we wouldn't just change scrollTo instead of making a new method?

@u01jmg3
Copy link
Contributor Author

u01jmg3 commented Apr 21, 2020

Nope other than scrollIntoView() is a more accurate method name as it links with the JavaScript API in use which developers are likely to recognise. However, this is not essential to consider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scrolling an element into view
2 participants