Skip to content

feat(rustdoc): open sidebar menu when links inside it are focused - #87180

Merged
bors merged 1 commit into
rust-lang:masterfrom
notriddle:notriddle/sidebar-keyboard-mobile
Jul 16, 2021
Merged

feat(rustdoc): open sidebar menu when links inside it are focused#87180
bors merged 1 commit into
rust-lang:masterfrom
notriddle:notriddle/sidebar-keyboard-mobile

Conversation

@notriddle

@notriddlenotriddle commented Jul 16, 2021

Copy link
Copy Markdown
Contributor

Fixes#87172

Based on #87167 (which should be merged first)

r? @GuillaumeGomez

Preview it at https://notriddle.com/notriddle-rustdoc-test/std/index.html

@rust-highfive

Copy link
Copy Markdown
Contributor

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 16, 2021
Comment threadsrc/librustdoc/html/static/js/main.js Outdated
@GuillaumeGomez

GuillaumeGomez commented Jul 16, 2021

Copy link
Copy Markdown
Member

There is a much simpler way to do it. I tested locally with:

$ git diff
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 9e3ad667531..8cddd85854a 100644
--- a/src/librustdoc/html/static/css/rustdoc.css+++ b/src/librustdoc/html/static/css/rustdoc.css@@ -1729,7 +1729,7 @@ details.undocumented[open] > summary::before {
width: calc(100% + 30px);
}
- .show-it {+ .show-it, .sidebar-elems:focus-within {+ z-index: 2;
left: 0;
}

With this, no need for JS. :)

The z-index: 2; is needed because .sidebar won't have the .mobile class and so the z-index of the sidebar won't be applied. The sidebar won't be completely displayed though but I consider that not adding JS is much better.

More information on :focus-withinhere.

Also, can you add a test in rustdoc-gui please? There is README file in src/test/rustdoc-gui to help you.

@notriddle
notriddleforce-pushed the notriddle/sidebar-keyboard-mobile branch from 5af79dd to 10d00a3CompareJuly 16, 2021 15:26
@notriddle

Copy link
Copy Markdown
ContributorAuthor

@GuillaumeGomez Okay, that's done.

Fixesrust-lang#87172
Based on rust-lang#87167 (which should be merged first)
Preview it at https://notriddle.com/notriddle-rustdoc-test/std/index.html
Co-authored-by: Guillaume Gomez <guillaume.gomez@huawei.com>
@notriddle
notriddleforce-pushed the notriddle/sidebar-keyboard-mobile branch from 10d00a3 to 0ea2980CompareJuly 16, 2021 15:32
@GuillaumeGomez

Copy link
Copy Markdown
Member

Awesome, thanks! Just waiting for CI then I r+.

@GuillaumeGomez

Copy link
Copy Markdown
Member

@bors: r+

@bors

bors commented Jul 16, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 0ea2980 has been approved by GuillaumeGomez

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 16, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jul 16, 2021
…d-mobile, r=GuillaumeGomez
feat(rustdoc): open sidebar menu when links inside it are focused
Fixesrust-lang#87172
Based on rust-lang#87167 (which should be merged first)
r? `@GuillaumeGomez`
Preview it at https://notriddle.com/notriddle-rustdoc-test/std/index.html
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 16, 2021
…laumeGomez
Rollup of 7 pull requests
Successful merges:
- rust-lang#87107 (Loop over all opaque types instead of looking at just the first one with the same DefId)
- rust-lang#87158 (Suggest full enum variant for local modules)
- rust-lang#87174 (Stabilize `[T; N]::map()`)
- rust-lang#87179 (Mark `const_trait_impl` as active)
- rust-lang#87180 (feat(rustdoc): open sidebar menu when links inside it are focused)
- rust-lang#87188 (Add GUI test for auto-hide-trait-implementations setting)
- rust-lang#87200 (TAIT: Infer all inference variables in opaque type substitutions via InferCx)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 12ed22f into rust-lang:masterJul 16, 2021
@rustbotrustbot added this to the 1.55.0 milestone Jul 16, 2021
@notriddle
notriddle deleted the notriddle/sidebar-keyboard-mobile branch May 21, 2022 16:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustdoc sidebar is not accessible from keyboard on small screens

5 participants

@notriddle@rust-highfive@GuillaumeGomez@bors@rustbot