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

Pages do not scroll to element when opened in Chrome background tab #7168

Open
jordanbtucker opened this issue Sep 15, 2022 · 5 comments
Open
Labels
🐛 bug Something isn't working, or isn't working as expected help wanted If you know something about this topic, we would love your help! idle p2 We want to address this but may have other higher priority items. ux make the user experience awesome

Comments

@jordanbtucker
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#examples

What specific section or headline is this issue about?

All headlines on all pages

What information was incorrect, unhelpful, or incomplete?

When a URL with a hash containing an element ID is opened in a background tab in Chrome, the page does not scroll to the element with that ID when the tab is brought to the foreground. When the same URL is opened in a foreground tab, the page scrolls correctly.

Steps to reproduce:

  1. Create a page with a link to an MDN URL with a hash property matching the ID of a valid element, like this URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#examples
  2. In Chrome, right-click the link and select Open link in new tab. This will open the page in a background tab.
  3. Open the background tab to bring it to the foreground.
  4. Note that the page has not scrolled to the element, e.g. the Examples section.

It appears that MDN is using a custom smooth-scrolling feature that does work when a tab is opened in the background. That feature should detect background tabs and possibly wait for the user to open the tab before scrolling.

What did you expect to see?

Pages should scroll to the correct section even when opened in a background tab.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Sep 15, 2022
@Josh-Cena Josh-Cena removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Sep 15, 2022
@Josh-Cena
Copy link
Member

@schalkneethling Could you transfer this to Yari? I had been constantly running into this as well. I think this has something to do with hydration (as always...)

@schalkneethling
Copy link
Contributor

Hi @jordanbtucker, thank you for filing an issue. The problem described here is not related to a content change but is something that needs to be addressed by engineering. We file engineering-related issues on the Yari repository. As such, the issue will move over to Yari.

@schalkneethling schalkneethling transferred this issue from mdn/content Sep 15, 2022
@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Sep 15, 2022
@caugner
Copy link
Contributor

caugner commented Oct 28, 2022

I was able to reproduce this issue in Chrome. In Firefox, the scroll happens as soon as I focus tab.

@caugner caugner added 🐛 bug Something isn't working, or isn't working as expected ux make the user experience awesome help wanted If you know something about this topic, we would love your help! p2 We want to address this but may have other higher priority items. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Oct 28, 2022
@caugner caugner changed the title Pages do not scroll to element when opened in background tab Pages do not scroll to element when opened in Chrome background tab Oct 28, 2022
@github-actions github-actions bot added the 🐌 idle Issues and PRs without recent activity. Flagged for maintainer follow-up. label Dec 4, 2022
@marvhock
Copy link

marvhock commented Dec 5, 2022

I have 2 additions to this bug.

1: Bug is also reproducible in Foreground-Tabs (Open URL in Adressbar directly), e.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment#syntax

2: On some pages the bug is reproducible and not on others (Regarding Foreground-Tabs):
Bug: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Assignment#syntax
Works Correctly: https://developer.mozilla.org/en-US/docs/Web/HTML#beginners_tutorials

Reproduced on:
Chrome Version 107.0.5304.121 (Mac), Chrome Canary Version 110.0.5458.0 (Mac), Chrome 108.0.5359.95 (Windows).

@github-actions github-actions bot removed the 🐌 idle Issues and PRs without recent activity. Flagged for maintainer follow-up. label Dec 5, 2022
@OnkarRuikar
Copy link
Contributor

Just an observation, it doesn't scroll when the page is highlighted in the sidebar:
scrollbug

If there is no highlight in the sidebar then it does scroll to the URL fragment. May be sidebar's logic to bring emphasis in the view is messing with the scroll to URL fragment location feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working, or isn't working as expected help wanted If you know something about this topic, we would love your help! idle p2 We want to address this but may have other higher priority items. ux make the user experience awesome
Projects
Status: No status
Development

No branches or pull requests

7 participants
@jordanbtucker @caugner @marvhock @schalkneethling @Josh-Cena @OnkarRuikar and others