Uh oh!
There was an error while loading. Please reload this page.
Inhibit clicks on summary's children - #91103
Conversation
rust-highfive
commented
Nov 21, 2021
Some changes occurred in HTML/CSS/JS. |
A byproduct of using `<details>` and `<summary>` to show/hide detailed documentation was that clicking any part of a method heading (or impl heading) would show or hide the documentation. This was not super noticeable because clicking a link inside the method heading would navigate to that link. But clicking any unlinked black text in a method heading would trigger the behavior. That behavior was somewhat unexpected, and means that if you try to click a type name in a method heading, but miss by a few pixels, you get a confusing surprise. This change inhibits that behavior by putting an event listener on most summaries that cancels the event unless the event target was the summary itself. In practice, that means it cancels the event unless the target was the "[+]" / "[-]", because the rest of the heading is wrapped inside a `<div>`, which is the target for anything that doesn't have a more specific target.
bd1b456 to
9aef9a2Compare
This comment has been minimized.
This comment has been minimized.
GuillaumeGomez
commented
Nov 21, 2021
Please add a GUI test, otherwise it seems like a good idea. It often happens that when I highlight something, it closes the the doc, which is a bit annoying. |
There was a problem hiding this comment.
You can click directly on h4.code-header. I'd much prefer avoiding to use hard coded positions if possible. :)
There was a problem hiding this comment.
Once you're done, please remove this one. ;)
jsha
commented
Nov 22, 2021
I wrote a GUI test, but I couldn't get it to work. I tried to find the coordinates on which to simulate a click by loading the page in a regular browser, but when I tell the tester to click on the coordinates that correspond to the toggle, it doesn't appear to do anything. I tried using |
GuillaumeGomez
commented
Nov 22, 2021
Ah right, for that I use |
fa0e2c3 to
3f3a7a2CompareUh oh!
There was an error while loading. Please reload this page.
GuillaumeGomez
commented
Nov 22, 2021
Looks good to me, one nit remaining but can be ignored. |
3f3a7a2 to
7f35556CompareGuillaumeGomez
commented
Nov 22, 2021
Thanks! r=me once CI pass |
jsha
commented
Nov 22, 2021
@bors try |
bors
commented
Nov 22, 2021
⌛ Trying commit 7f35556 with merge 057c2213acefad12356c4f990ecff30c5b32bdf6... |
GuillaumeGomez
commented
Nov 22, 2021
Why the try? |
jsha
commented
Nov 22, 2021
Perhaps I misread the bors docs? Was attempting to trigger a normal re-run of the tests, since I can't reproduce the failure locally. And the CI status reported here doesn't show a failure, just a cancelled check? https://bors.tech/documentation/ |
GuillaumeGomez
commented
Nov 22, 2021
It's easier this way. ;) |
jsha
commented
Nov 23, 2021
@bors r=Manishearth,GuillaumeGomez |
bors
commented
Nov 23, 2021
📌 Commit 7f35556 has been approved by |
…, r=Manishearth,GuillaumeGomez Inhibit clicks on summary's children A byproduct of using `<details>` and `<summary>` to show/hide detailed documentation was that clicking any part of a method heading (or impl heading) would show or hide the documentation. This was not super noticeable because clicking a link inside the method heading would navigate to that link. But clicking any unlinked black text in a method heading would trigger the behavior. That behavior was somewhat unexpected, and means that if you try to click a type name in a method heading, but miss by a few pixels, you get a confusing surprise. This change inhibits that behavior by putting an event listener on most summaries that cancels the event unless the event target was the summary itself. In practice, that means it cancels the event unless the target was the "[+]" / "[-]", because the rest of the heading is wrapped inside a `<div>`, which is the target for anything that doesn't have a more specific target. r? `@Manishearth`
…askrgr Rollup of 6 pull requests Successful merges: - rust-lang#90856 (Suggestion to wrap inner types using 'allocator_api' in tuple) - rust-lang#91103 (Inhibit clicks on summary's children) - rust-lang#91137 (Give people a single link they can click in the contributing guide) - rust-lang#91140 (Split inline const to two feature gates and mark expression position inline const complete) - rust-lang#91148 (Use `derive_default_enum` in the compiler) - rust-lang#91153 (kernel_copy: avoid panic on unexpected OS error) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
…eGomez Fix toggle-click-deadspace rustdoc-gui test In rust-lang#91103 I introduced a rustdoc-gui test for clicks on toggles. I introduced some documentation on a method in lib2/struct.Foo.html so there would be something to toggle, but accidentally left the test checking test_docs/struct.Foo.html. That caused the test to reliably fail. I'm not sure how that test got past GitHub Actions and bors, but it's manifesting in test failures at rust-lang#91062 (comment) and rust-lang#91170 (comment). This fixes by pointing at the right file. r? `@GuillaumeGomez`
A byproduct of using
<details>and<summary>to show/hide detailed documentation was that clicking any part of a method heading (or impl heading) would show or hide the documentation. This was not super noticeable because clicking a link inside the method heading would navigate to that link. But clicking any unlinked black text in a method heading would trigger the behavior.That behavior was somewhat unexpected, and means that if you try to click a type name in a method heading, but miss by a few pixels, you get a confusing surprise.
This change inhibits that behavior by putting an event listener on most summaries that cancels the event unless the event target was the summary itself. In practice, that means it cancels the event unless the target was the "[+]" / "[-]", because the rest of the heading is wrapped inside a
<div>, which is the target for anything that doesn't have a more specific target.r? @Manishearth