components icon indicating copy to clipboard operation
components copied to clipboard

[Tabs] ScrollTop is not working when tab is changed from left to right in MdTabGroup

Open ubarsaiyan opened this issue 9 years ago • 4 comments

Bug

Follow-up to the issue #4989 I wrote a code that saves the scroll position of the current tab body's div and when we return to that tab it sets the scroll position to the stored value. By logging in the console I find the values stored and retrieved to be correct. But: When I select a tab that is to the right of the currently active tab, the scroll position can not be set. But the same code sets the scroll position of the div if I select a tab that is towards the left of the currently active tab.

What is the expected behavior?

The scroll position should be set irrespective of the positions of the tab. The code should either work for all cases or none.

What is the current behavior?

When I select a tab that is to the right of the currently active tab, the scroll position can not be set. But the same code sets the scroll position of the div if I select a tab that is towards the left of the currently active tab.

What are the steps to reproduce?

Plnkr: http://plnkr.co/edit/MeQj4zUAQ9qHiFgm7f0J?p=preview Go to the second tab. Scroll down to some position. Go to tab 3. Come back to Tab 2. The scroll position should be saved. Repeat the same but go to Tab 1 instead of Tab 3. The scroll position resets to zero.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

The same issue is produced in Chrome and Firefox.

Is there anything else we should know?

Calling the function from selectChange does not even save the scroll position correctly. That's why I put that function in focusChange. I have three functions in the original code: one that saves the scroll position, one that selects the content to show after the tab switches and one that sets the scroll position to the saved value. And I want to call the three functions sequentially by calling them from selectChange instead of focusChange. And the saved scroll position is correct in every case.

ubarsaiyan avatar Jun 08 '17 11:06 ubarsaiyan

First of all I need to point out Id are unique, so you should not use them multiple times in the same page. Some browser support multiple id like firefox, IE.

raghukul01 avatar Jun 08 '17 20:06 raghukul01

@raghukul01 But at a time only one div is present with that id. So, is that still a problem?

ubarsaiyan avatar Jun 08 '17 20:06 ubarsaiyan

We are closing this issue, because we've determined, using a semi-automated process, that it is no longer relevant, has low engagement, or it does not have enough information to proceed. Feel free to comment if you think the issue should be reopened, or open a new issue with the latest version of our code instead.

crisbeto avatar May 29 '26 12:05 crisbeto

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.