Skip to content

Changed logic so that _scrollToTopIfVisible is called only if element is in viewport. Previously it was called only when the element was outside it. #23390

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

Merged
merged 4 commits into from
Jul 1, 2019

Conversation

oskarolaussen
Copy link
Contributor

@oskarolaussen oskarolaussen commented Jun 25, 2019

Description (*)

Noticed that _scrollToTopIfVisible was called only if changing element was outside of viewport and thus wasn't working as intended.

Fixed Issues (if relevant)

Manual testing scenarios (*)

On product page scroll so that .product.data.items is partially visible.
Change tab. The whole .product.data.items should scroll into view.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

… is in viewport. Previously it was called only when the element was outside it. Also changed the logic of _isElementOutOfViewport to work correctly.
… is in viewport. Previously it was called only when the element was outside it. Also changed the logic of _isElementOutOfViewport to work correctly.
@m2-assistant
Copy link

m2-assistant bot commented Jun 25, 2019

Hi @oskarolaussen. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-cicd2
Copy link
Contributor

magento-cicd2 commented Jun 25, 2019

CLA assistant check
All committers have signed the CLA.

… element is in viewport. Previously it was called only when the element was outside it. Also changed the logic of _isElementOutOfViewport to work correctly."

This reverts commit b5f2357.
@sidolov
Copy link
Contributor

sidolov commented Jun 25, 2019

Hi @oskarolaussen , looks like you made some commits with email different than in your GitHub profile, please, add email from commits to your profile!
Thank you!

@oskarolaussen
Copy link
Contributor Author

Hi @sidolov! Commits should now be correctly attributed to me.

@oskarolaussen
Copy link
Contributor Author

oskarolaussen commented Jun 26, 2019

I reverted _isElementOutOfViewport to how it was originally as it worked correctly. I had my coordinate system mixed up. Sorry! Edited the title and description accordingly.

But the fix for _scrollToTopIfVisible should still be valid.

@oskarolaussen oskarolaussen changed the title Changed logic so that _scrollToTopIfVisible is called only if element is in viewport. Previously it was called only when the element was outside it. Also changed the logic of _isElementOutOfViewport to work correctly. Changed logic so that _scrollToTopIfVisible is called only if element is in viewport. Previously it was called only when the element was outside it. Jun 26, 2019
@ghost ghost assigned sidolov Jun 26, 2019
@sidolov sidolov added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Jun 26, 2019
@magento-engcom-team
Copy link
Contributor

Hi @sidolov, thank you for the review.
ENGCOM-5362 has been created to process this Pull Request

@magento-engcom-team
Copy link
Contributor

@oskarolaussen thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository.

@engcom-Delta
Copy link
Contributor

✔️ QA passed

@engcom-Foxtrot engcom-Foxtrot self-assigned this Jun 27, 2019
taskula pushed a commit to Hypernova-Oy/magento2 that referenced this pull request Jul 1, 2019
…ly if element is in viewport. Previously it was called only when the element was outside it. magento#23390
@magento-engcom-team magento-engcom-team merged commit 00b5bfe into magento:2.3-develop Jul 1, 2019
@m2-assistant
Copy link

m2-assistant bot commented Jul 1, 2019

Hi @oskarolaussen, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@Karlasa
Copy link
Contributor

Karlasa commented Aug 29, 2019

@magento-engcom-team I think this PR should be reverted.

  1. It was working as intended before. No need to position screen with each element change. (maybe just function name is odd)
  2. fix for this PR introduces more issues on page load with collapsible element that has default state open.

@vovayatsyuk
Copy link
Member

vovayatsyuk commented Oct 9, 2019

I'm not happy with this update too.

Now the whole page is jumping each time I click the tab 😕
Layered navigation is affected too (As well as all other collapsible elements).

Tabs Filters
Peek 2019-10-09 11-39 Peek 2019-10-09 11-41

I think that the _scrollToTopIfVisible was written as _scrollToTopIfNotVisible intentionally (It was just an invalidly named function). I can't imagine why you would need to scroll the page if the content is already visible.

@vovayatsyuk
Copy link
Member

p.s. Do you realize that now scroll will not work when the element is outside of the viewport?

@oskarolaussen
Copy link
Contributor Author

I encountered a situation where the previous function caused undesired behaviour and since the name didn't match the logic I decided to "fix" it. As it seems to cause more problems than it fixes I'm fully onboard with reverting this PR. Sorry about the inconvenience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Lib/Frontend Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Progress: accept Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants