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

Don't collapse by default #145

Closed
fantasai opened this issue Jan 24, 2018 · 6 comments
Closed

Don't collapse by default #145

fantasai opened this issue Jan 24, 2018 · 6 comments
Labels

Comments

@fantasai
Copy link
Contributor

fantasai commented Jan 24, 2018

Collapsing the specification metadata makes a lot of important items invisible by default. Most people who are new to specifications won't think to look there for that information, because they won't know that information even exists. Things like where the test suite is, where to file bugs and send feedback, the fact that this is or is not the canonical version of the specification... these are not things that one will discover, ever, if they are hidden by default. If this data is in the way of day-to-day users, they can hide it and W3C can script that state to persist. But for new people showing up to a specification for the first time, these should not be hidden.

We can argue that this information should be better-presented, and that it should be more compact--and rather more importantly that all of the boilerplate in Status of This Document should be smote--but that is a longer-term project (1-2yrs); in the meantime we shouldn't regress discoverability of the spec process, something which these links are critical to.

@marcoscaceres
Copy link
Member

Agree. As @fantasai proposes, something nice across the top of the doc would be awesome (these could be menus that expand to link to the right things... but the things people need would still be quickly accessible, like Editor's draft and Test Suite):

THE BLA BLA SPEC
=================================================
Versions |  Editor's Draft | Repository | Commit History | Test Suite 
=================================================

@plehegar
Copy link
Member

plehegar commented Jul 5, 2018

I'll update the proposal as follows:

THE BLA BLA SPEC
<status> <date>
=================================================
Versions | Repository | Test
=================================================

More about this specification

with Versions|Repository|Test drops down.
And "More about this specification" is collapsed by default

@fantasai
Copy link
Contributor Author

fantasai commented Oct 6, 2021

@plehegar This issue is relevant for the 2021 redesign, please don't forget about it.
https://www.w3.org/mid/a4a76d22-4964-0b62-8156-1b96e3387eda@inkedblade.net

@LeaVerou
Copy link
Member

LeaVerou commented Oct 20, 2021

Agreed with @fantasai that the section should be open by default so that newcomers know where to find this information. But regardless of what the default is, the user's choice needs to be remembered. However, it's unclear to me whether toggling it should be assumed to set a preference across all specs of the origin, or just for the specific spec.

Since implementing this seems to be a sticking point right now, I took a stab at writing some code for both of these cases. I've verified it works, though I haven't done extensive testing.

To remember choice across all specs of the same origin:

let details = document.querySelector(".head details");

if (localStorage.spec_details_open !== undefined) {
	details.open = localStorage.spec_details_open === "true";
}

if (details) {
	details.addEventListener("toggle", evt => {
		localStorage.spec_details_open = evt.target.open;
	});
}

To remember choice only for the current spec:

let details = document.querySelector(".head details");

if (localStorage.spec_details_open) {
	let openData = JSON.parse(localStorage.spec_details_open);
	let open = openData[location.pathname];

	if (open !== undefined) {
		details.open = open;
	}
}

if (details) {
	details.addEventListener("toggle", evt => {
		let openData = JSON.parse(localStorage.spec_details_open || "{}");
		// We only need the pathname, localStorage is separate for other origins anyway
		openData[location.pathname] = evt.target.open;
		localStorage.spec_details_open = JSON.stringify(openData);
	});
}

@fantasai
Copy link
Contributor Author

@LeaVerou Thanks!!! Yeah, we should remember across the whole origin. Usually if you open it, you want it open for awhile as you click through a bunch of specs. And if you want it closed, you want it closed again as you're back to ignoring metadata. ;)

@plehegar
Copy link
Member

(note that the markup now contains <details open>. @deniak took care of the JS (and the JS may still be tweaked later as needed btw).

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

No branches or pull requests

4 participants