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

Multipage should be more accessible #631

Open
gibson042 opened this issue Dec 28, 2024 · 5 comments
Open

Multipage should be more accessible #631

gibson042 opened this issue Dec 28, 2024 · 5 comments

Comments

@gibson042
Copy link
Contributor

gibson042 commented Dec 28, 2024

Having multipage support is great, but it should be more accessible... for example, loading the single-page https://tc39.es/ecma262/ from a linked term in https://tc39.es/ecma402/ or loading a build preview such as https://ci.tc39.es/preview/tc39/ecma262/pull/3513 from a GitHub Actions CI link on a Chrome DevTools "Slow 4G" connection:

The "never indicates does not highlight multipage" issue could be solved with a floating link, possibly cleared/moved/otherwise de-emphasized on completion of page load (cf. https://html.spec.whatwg.org/ ).

The "after HTML has been parsed" issues stem from use of <script defer>, which I think would be better behaved as <script async> or possibly even loading doShortcut as a blocking script before the body (and probably updating it to tolerate an undefined idToSection).

The re-navigation issue is the smallest of these, but could be solved by loading multipage.js (specifically for idToSection and the re-navigation logic) even on the single-page view for use by doShortcut.

And as suggested below, a cookie to force either single-page or multi-page with a check and redirection in a blocking script at the beginning of the page would preempt the need for any future interaction at all.

@gibson042
Copy link
Contributor Author

Related #195

@bakkot
Copy link
Contributor

bakkot commented Dec 28, 2024

never indicates the presence of a multipage alternative

It's linked in the very first text in the body of the page:

Image

I know people tend to gloss over the frontmatter, but it is at least there. Not as helpful when you're jumping to a specific term, of course.

The "after HTML has been parsed" issues stem from use of <script defer>, which I think would be better behaved as <script async> or possibly even loading doShortcut as a blocking script before the body (and probably updating it to tolerate an undefined idToSection).

I believe HTML rendering blocks the main thread, so I don't know that messing with the placement of the script would have any effect (because it can't run the shortcut event handler until after the main thread is unblocked), but I could be wrong; if you want to experiment and find that it does work I'd happily take a PR.

Alternatively, we could have some way of indicating that the user would prefer to always be redirected to the multipage version, and do that check+redirect in a blocking script at the beginning of the page.

@ljharb
Copy link
Member

ljharb commented Dec 28, 2024

Having an input that sets a cookie and indicates the user's preference (for both always multipage, or never multipage) would be great. (Since I don't use Chrome, I don't have any slowness with the single-page version, so I always prefer single-page for the find-in-page capability)

@gibson042
Copy link
Contributor Author

gibson042 commented Dec 29, 2024

I know people tend to gloss over the frontmatter, but it is at least there.

Thanks; acknowledged and updated.

Not as helpful when you're jumping to a specific term, of course.

Indeed.

I believe HTML rendering blocks the main thread, so I don't know that messing with the placement of the script would have any effect (because it can't run the shortcut event handler until after the main thread is unblocked), but I could be wrong; if you want to experiment and find that it does work I'd happily take a PR.

Confirmed on both Chrome and Firefox that <script src="assets/ecmarkup.js?cache=…" async> makes the shortcut available before rendering is complete (although ecmarkup.js being 1.3 MB itself still delays things more than is ideal).

Alternatively, we could have some way of indicating that the user would prefer to always be redirected to the multipage version [Having an input that sets a cookie and indicates the user's preference (for both always multipage, or never multipage) would be great], and do that check+redirect in a blocking script at the beginning of the page.

I am in favor of this as well, and have added it to the description.

Since I don't use Chrome, I don't have any slowness with the single-page version

@ljharb See «on a Chrome DevTools "Slow 4G" connection» in the issue description; this is about efficiency of transferring content rather than in dealing with it after the fact.

@ljharb
Copy link
Member

ljharb commented Dec 30, 2024

ah, fair enough. i'd still rather wait for the single-page load rather than lose out on find-in-page, personally :-) but that's what configuration is for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants