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

Rustdoc line number desynchronization on iPhone Safari #102404

Closed
pali6 opened this issue Sep 28, 2022 · 5 comments
Closed

Rustdoc line number desynchronization on iPhone Safari #102404

pali6 opened this issue Sep 28, 2022 · 5 comments
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@pali6
Copy link

pali6 commented Sep 28, 2022

On iPhone Safari 15.1 (and possibly other mobile browsers, I am unable to check EDIT: Android browsers do not have this issue) in the source view code lines get line wrapped which causes the line numbers to desynchronize from their lines. In some cases multi-digit line numbers also get line wrapped which causes further desynchronization, though from my checking this currently happens for docs hosted on docs.rs but not on doc.rust-lang.org/std. This issue also means that clicking on source links in documentation leads to completely unrelated code as the links are to the line numbers and not the lines themselves.

This issue does not happen on Windows browsers I tested when I manually shrink the window to be approximately as narrow as the mobile browser. I have not tested the issue with computer version of Safari.

https://doc.rust-lang.org/src/std/lib.rs.html#1-633 viewed on iPhone Safari 15.1 (note how one code line covers multiple line numbers when it wraps):
image

https://doc.rust-lang.org/src/std/lib.rs.html#1-633 viewed on Windows Firefox 105.0.1 with similar window size (no issue here):
image

https://docs.rs/smallvec/latest/src/smallvec/lib.rs.html#1485 viewed on iPhone Safari 15.1 (no source code is visible because the multi-line line numbers scroll way beyond source code):
image

https://docs.rs/smallvec/latest/src/smallvec/lib.rs.html#1485 viewed on iPhone Safari 15.1 and manually scrolled to the correct line (note the incorrect line numbers that cover multiple actual code lines):
image

https://docs.rs/smallvec/latest/src/smallvec/lib.rs.html#1485 viewed on Windows Firefox 105.0.1 with similar window size (no issue here):
image

@the8472 the8472 added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-rustdoc-ui Area: Rustdoc UI (generated HTML) labels Sep 28, 2022
@GuillaumeGomez
Copy link
Member

I don't have an iphone so I won't be able to check what's going. Does someone on the @rust-lang/rustdoc team has an iphone by any chance?

@pali6 pali6 changed the title Rustdoc line number desynchronization on mobile screens Rustdoc line number desynchronization on iPhone Safari Sep 28, 2022
@jsha
Copy link
Contributor

jsha commented Sep 28, 2022

I've got one and will check.

@jsha
Copy link
Contributor

jsha commented Sep 29, 2022

I was unable to reproduce on iPhone 15.5. The lines don't wrap at all, which is expected behavior.

It looks like the latest iOS version is 15.7. I'm upgrading to that now. @pali6 would you mind upgrading to 15.7 as well and seeing if it still reproduces for you?

@pali6
Copy link
Author

pali6 commented Sep 29, 2022

That indeed fixed the issue. My bad for not staying updated.

@pali6 pali6 closed this as completed Sep 29, 2022
@jsha
Copy link
Contributor

jsha commented Sep 29, 2022

No worries! Thanks for taking the time.

notriddle added a commit to notriddle/rust that referenced this issue Mar 23, 2023
This is based on the compatibility data for `window.matchMedia` and
`MediaQueryList`'s `EventTarget` implementation.

https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList#browser_compatibility

https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia#browser_compatibility

  * EventTarget would require us to drop support for all Chrome
    versions before 39. However, we already require Chrome 49,
    because rustdoc requires [CSS variables].
  * EventTarget would also limit us to Firefox 55, but since rust-lang#106502
    rustdoc only supports Firefox > 68.
  * EventTarget limits us to Mobile Safari version 14, but rust-lang#102404
    shows that our CSS is broken in Safari versions before 15.5.

[CSS variables]: https://developer.mozilla.org/en-US/docs/Web/CSS/--*#browser_compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants