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

cn.history.js.org - Scroll position not remembered when returning back #74843

Closed
lilydjwg opened this issue May 24, 2021 · 7 comments
Closed
Labels
browser-firefox engine-gecko The browser uses the Gecko rendering engine os-linux Issues only happening on Linux. priority-normal severity-important A non-core broken piece of functionality, not behaving the way you would expect. type-webrender-enabled Firefox webrender engine pref
Milestone

Comments

@lilydjwg
Copy link

URL: https://cn.history.js.org/part-1.html

Browser / Version: Firefox 90.0
Operating System: Linux
Tested Another Browser: Yes Chrome

Problem type: Something else
Description: scroll position not remembered between
Steps to Reproduce:
Scroll and click a note link to navigate to the footnotes page, then go back. The scroll position is not remembered in Firefox.

View the screenshot Screenshot
Browser Configuration
  • gfx.webrender.all: true
  • gfx.webrender.blob-images: true
  • gfx.webrender.enabled: false
  • image.mem.shared: true
  • buildID: 20210514215821
  • channel: nightly
  • hasTouchScreen: false
  • mixed active content blocked: false
  • mixed passive content blocked: false
  • tracking content blocked: false

View console log messages

From webcompat.com with ❤️

@webcompat-bot webcompat-bot added this to the needstriage milestone May 24, 2021
@webcompat-bot webcompat-bot added browser-firefox engine-gecko The browser uses the Gecko rendering engine type-webrender-enabled Firefox webrender engine pref labels May 24, 2021
@lilydjwg
Copy link
Author

This happens on both desktop and mobile Firefoxes and makes the reading experience very bad. It works well on both desktop and mobile Chromes.

@softvision-oana-arbuzov softvision-oana-arbuzov added the os-linux Issues only happening on Linux. label May 25, 2021
@softvision-oana-arbuzov
Copy link
Member

Thanks for the report, I was able to reproduce the issue.
PositionNotKept

Note: The issue does not occur on Chrome.

Tested with:
Browser / Version: Firefox Nightly 91.0a1 (2021-06-02)
Operating System: Ubuntu 20.04.2

Moving to Needsdiagnosis for further investigation.

@softvision-oana-arbuzov softvision-oana-arbuzov changed the title cn.history.js.org - see bug description cn.history.js.org - Scroll position not remembered when returning back Jun 3, 2021
@softvision-oana-arbuzov softvision-oana-arbuzov added priority-normal severity-important A non-core broken piece of functionality, not behaving the way you would expect. labels Jun 3, 2021
@denschub denschub modified the milestone: needsdiagnosis Jun 7, 2021
@karlcow
Copy link
Member

karlcow commented Jul 26, 2021

There is a console error.

when I click on 12 it goes to https://cn.history.js.org/notes.html#12
then back and it goes to the top.

it calls in https://cn.history.js.org/index.js

function popstateHandler() {
  rerender(location).catch(errorHandler);
}

with location being https://cn.history.js.org/part-1.html.

then it reaches

        window.ReactDOM.render(window.React.createElement(Layout, props), document);
        if (!hash) {
            window.scrollTo(0, 0);
        } else {
            document.getElementById(hash.slice(1))?.scrollIntoView();
        }

in Gecko and Blink (Edge) hash is an empty string ""

And both go back to the top of the page. I have no differences.

note that both engines display:

_main.js:14 Uncaught TypeError: Cannot read properties of null (reading 'getBoundingClientRect')
    at scrollHandler (_main.js:14)
    at y (throttle.js:2)
    at ae (throttle.js:2)
    at w (throttle.js:2)

@softvision-oana-arbuzov do you have a difference in between blink Edge and blink Chrome on desktop?

@lilydjwg agreed that's painful, but this is happening on both Edge and Firefox.

But this is working in Safari Tech Preview! Interesting. Oh… maybe a race issue.
This is happening in Safari Tech Preview if I set a breakpoint in the code and the devtools are opened.

@karlcow
Copy link
Member

karlcow commented Jul 26, 2021

hmmm in fact if I read this correctly, the site is asking to back to the top of the page with window.scrollTo(0, 0);.
https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo

So somehow Firefox And Edge do the right thing.

@karlcow
Copy link
Member

karlcow commented Jul 26, 2021

@doodlewind Is the owner of the site.
Let's see if he is experiencing the same issue.
https://github.com/doodlewind/jshistory-cn/issues

@lilydjwg Could you open an issue there?

@karlcow karlcow modified the milestones: needsdiagnosis, sitewait Jul 26, 2021
@lilydjwg
Copy link
Author

Sure, I'm opening.

@softvision-oana-arbuzov
Copy link
Member

Thanks @lilydjwg .

Closing the issue as duplicate of doodlewind/jshistory-cn#33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser-firefox engine-gecko The browser uses the Gecko rendering engine os-linux Issues only happening on Linux. priority-normal severity-important A non-core broken piece of functionality, not behaving the way you would expect. type-webrender-enabled Firefox webrender engine pref
Projects
None yet
Development

No branches or pull requests

5 participants