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

Miscellaneous improvements for the WPT element #2010

Merged
merged 11 commits into from
Apr 12, 2021
Merged

Miscellaneous improvements for the WPT element #2010

merged 11 commits into from
Apr 12, 2021

Conversation

frivoal
Copy link
Contributor

@frivoal frivoal commented Apr 3, 2021

Here's a loosely related set of tweaks, fixes, and new features to how the wpt elements work. I suppose I could send that as a bunch of separate PRs, but that seems like unnecessary overhead.
Some issues covered by this:

Not sure if this is easier to review commit by commit or not, but each commit should be clean, so you can if you want to, and I suspect the commit messages will give a bit of context about why I'm doing what I'm doing. One of the commits (4e53842) changes the indentation of a large block of code, so at least that one is probably easier to review with --ignore-space-change

Some of these choices are probably subjective, but I'm pretty happy with the result. Let me know if anything isn't to your liking.

I think that with these in place, I'd be happy to turn WPT Display on by default on all my EDs: it would encourage readers in general (and implementers in particular) to look up the results of tests as they read various sections of the spec to see how well implementations are doing (and possibly file/fix bugs). Also, it would make it easier to notice when some part of the document doesn't have tests, and encourage writing them. (As for turning it on on TR, we'd probably have to sync up with pubrules and tr-design, but one thing at a time).

Maybe we could add "WPT Display": "closed" to boilerplate/csswg/defaults-ED.include. Besides giving us a good bunch of annotated EDs, that'll nicely populate the tests as well.

@frivoal
Copy link
Contributor Author

frivoal commented Apr 3, 2021

Never mind this comment, I've changed my mind. I previously proposed here some tentative changes to how things could be styled (see below), but have since found a better way and included that in the pull request.

Also, as a possible alternative to the right floats for the closed state, another variant I quite like is with inline-blocks. You can try it out by applying this after the latest commit.

diff --git a/bikeshed/wpt/wptElement.py b/bikeshed/wpt/wptElement.py
index 9c6b614a9..76295f62b 100644
--- a/bikeshed/wpt/wptElement.py
+++ b/bikeshed/wpt/wptElement.py
@@ -323,18 +323,14 @@ wptStyle = """
     color: var(--wpt-border);
 }
 .wpt-tests-block:not([open]){
-    border-left: none;
-    background: none;
     margin: 0;
-    padding: 0;
-    border-top: 1px dotted var(--wpt-border);
+    padding-bottom: 0;
+    border: none;
     opacity: 0.5;
+    display: inline-block;
 }
 .wpt-tests-block:not([open]) summary{
-    background: var(--wpt-bg);
     padding: 0;
-    float: right;
-    max-width: max-content;
     font-size: 0.8em;
     line-height: 1;
 }

frivoal added 11 commits April 9, 2021 18:18
Lists can be pretty long and get in the way of spec readability otherwise.
The pathprefix attribute of the wpt element has done its job by the time
we generate the output, and it is a non-standard one, so remove it
Document the fact that the hidden attribute on wpt elements lets you
exclude them from the output, while letting bikeshed check their
contents. And while we're at it, remove them entirely from the output.

Relates to #1895
Also, take advantage of that to add a description of wpt blocks in the
"Document conventions" sections of boilerplate files
Having multiple successive wpt elements in the source can happen due to
wanting a different pathprefix, but there's no reason to keep this
separation in the output since the prefixes have been processed away.
Most readers of a spec are not here for the tests, so wpt elements,
particularly in their closed state, should get out of the way, and
disturb the general typography of the document as little as possible.
Hot pink wasn't the ideal color for that (and it's very close to the
w3c-chosen purple color used for candidate corrections anyway), so this
commit replaces that with gray. In the closed state, wpt elements are
made small, semi-transparent, right aligned, and fitting into the margin
between the elements they annotate.
@frivoal
Copy link
Contributor Author

frivoal commented Apr 9, 2021

Maybe we could add "WPT Display": "closed" to boilerplate/csswg/defaults-ED.include.

@fantasai had a look at the output and liked it, so I've tentatively included this in the PR as well.

@tabatkins
Copy link
Collaborator

All right, finally had a chance to look at this, and it looks great. I'll probably actually log a breaking change to make "closed" the default, so people can prep by turning it off if they want.

@tabatkins tabatkins merged commit a042bcd into speced:main Apr 12, 2021
@frivoal frivoal deleted the wpt-improvements branch April 14, 2021 02:59
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

Successfully merging this pull request may close these issues.

2 participants