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

Update theme on pageshow event #93253

Merged
merged 1 commit into from Jan 24, 2022
Merged

Update theme on pageshow event #93253

merged 1 commit into from Jan 24, 2022

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Jan 24, 2022

When a user goes forward or back, the page may be rendered from the back/forward cache (https://web.dev/bfcache/) rather than from scratch. If they have changed theme in the meantime, that means seeing an incorrect theme on the page they went forward or back to. The pageshow event fires on such navigations, so we can update the theme based on that event.

Demo: https://rustdoc.crud.net/jsha/theme-on-show/std/string/trait.ToString.html

r? @GuillaumeGomez

When a user goes forward or back, the page may be rendered from the
back/forward cache (https://web.dev/bfcache/) rather than from scratch. If
they have changed theme in the meantime, that means seeing an incorrect
theme on the page they went forward or back to. The `pageshow` event
fires on such navigations, so we can update the theme based on that event.
@jsha jsha added the A-rustdoc-ui Area: rustdoc UI (generated HTML) label Jan 24, 2022
@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jan 24, 2022
@GuillaumeGomez
Copy link
Member

Quite the tricky case, good catch! I now see why you opened GuillaumeGomez/browser-UI-test#245. I'll open an issue so we don't forget to add a test. Thanks!

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jan 24, 2022

📌 Commit b30725e has been approved by GuillaumeGomez

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 24, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 24, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#92513 (std: Implement try_reserve and try_reserve_exact on PathBuf)
 - rust-lang#93152 (Fix STD compilation for the ESP-IDF target (regression from CVE-2022-21658))
 - rust-lang#93186 (Fix link to CVE-2022-21658)
 - rust-lang#93188 (rustdoc: fix bump down typing search on Safari)
 - rust-lang#93212 (Remove unneeded cursor pointer rule on mobile sidebar)
 - rust-lang#93231 (adjust sidebar link brightness)
 - rust-lang#93241 (Fix brief appearance of rust logo in the sidebar)
 - rust-lang#93253 (Update theme on pageshow event)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ee35ed3 into rust-lang:master Jan 24, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 24, 2022
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) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants