NEW 272624
Using <main tabindex=-1> does not maintain scroll position when returning to the page
https://bugs.webkit.org/show_bug.cgi?id=272624
Summary Using <main tabindex=-1> does not maintain scroll position when returning to ...
Dan
Reported 2024-04-13 01:50:16 PDT
Created attachment 470911 [details] A test-case using <main tabindex=-1> A web page using `<main tabindex=-1>` for its main content area (a common markup pattern for „Skip to content” links) loses its scroll position on iOS Safari when navigating away from the page, then tapping the Back button. The scroll position is moved to the top of the `<main>` element. This seems related to the fact that focus (as evidenced by document.activeElement) returns to the `<main>` element, which may cause the browser to scroll it into view. This only happens on iOS Safari, macOS Safari works well.
Attachments
A test-case using <main tabindex=-1> (6.86 KB, text/html)
2024-04-13 01:50 PDT, Dan
no flags
Radar WebKit Bug Importer
Comment 1 2024-04-13 01:50:25 PDT
Ahmad Saleem
Comment 2 2024-04-15 06:46:31 PDT
Dan - does this use to work in previous iOS releases?
Dan
Comment 3 2024-04-15 06:53:13 PDT
Ahmad, based on my tests in Browserstack, the issue seems to have been introduced around iOS/Safari 14.
Note You need to log in before you can comment on or make changes to this bug.