| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Restore sans-serif font for module items.
This was broke in #84462 by modifying a style that applied both to
searches and to module items (and other tables).
Fixes #85616.
Fixes https://github.com/rust-lang/rust/issues/85545.
r? `@camelid`
|
|
Fix search results display
Fixes https://github.com/rust-lang/rust/issues/85544.
cc `@dns2utf8`
r? `@jsha`
|
|
This was broke in #84462 by modifying a style that applied both to
searches and to module items (and other tables).
|
|
Fix auto-hide for implementations and implementors.
This sets their toggles to be closed in the HTML (matching the default
setting), and opens them if the setting indicates to do so.
This distinguishes between implementations and implementors based on
being descendants of certain named elements.
Demo https://hoffman-andrews.com/rust/fix-toggle-settings/std/io/trait.Read.html#implementors
and https://hoffman-andrews.com/rust/fix-toggle-settings/std/string/struct.String.html#trait-implementations
Fixes #85411
r? `@GuillaumeGomez`
|
|
This sets their toggles to be closed in the HTML (matching the default
setting), and opens them if the setting indicates to do so.
This distinguishes between implementations and implementors based on
being descendants of certain named elements.
|
|
|
|
|
|
|
|
|
|
|
|
Search result extra info
The CSS rule was not updated when we updated the search result, this fixes it:
Before:

After:

r? `@jsha`
|
|
|
|
Remove dead toggle JS code
Explanations on how I got there: I randomly saw `adjustToggle` while browsing through code, checked where it was called, put a `debugger;` instruction in it and checked on all pages while playing with settings and toggles. The breakpoint was never triggered. I then looked at `collapseNonInherent` (its grand-parent). In there, the breakpoint was triggered so I look at what was being done and in fact... nothing. So I simply removed it all, re-ran the tests and play with the UI. Everything is working as expected.
Better double check in case I forgot to check a case though, but if nothing has been left out, then it's a great cleanup once again. :)
r? ``@jsha``
|
|
Reset "focusedByTab" field when doing another search
Fixes https://github.com/rust-lang/rust/issues/85467.
The problem was simply that we forget to reset the `focusedByTab` field, which was still referring to removed DOM elements.
r? ``@jsha``
|
|
|
|
|
|
Prevent tab title to "null" if the URL is a search one
When we arrive on page with a search parameter in the URL, until the results are displayed, the page title is "null". It's because of this code:
```js
if (params.search !== undefined) {
var search = searchState.outputElement();
search.innerHTML = "<h3 style=\"text-align: center;\">" +
searchState.loadingText + "</h3>";
searchState.showResults(search);
loadSearch();
}
```
In `searchState.showResults`, we have this:
```js
document.title = searchState.title;
```
But since it's `null`, we set it as title. This PR fixes it.
r? `@jsha`
|
|
|
|
|
|
Fix invalid CSS rules for a:hover
When hovering some links:


It is a side-effect from #84462.
r? ```@jsha```
|
|
Add method-toggle to <details> for methods
The makes the code for handling "auto-hide" settings more consistent.
Demo at https://hoffman-andrews.com/rust/hoist-classes/std/string/struct.String.html
Fixes #84829
|
|
|
|
Fix escape handling
Currently, when we press Escape while on the search results, nothing is happening, this PR fixes it.
More information: it's because in case the element doesn't exist, `hasClass` will return `null`, which coerces into `false` with the `!` comparison operator. But even if it returned `false`, it would still be an issue because if the element doesn't exist, it means it's hidden so in this case it's just as good, hence the additional check I added.
r? ``@jsha``
|
|
rustdoc: restore header sizes
The `<details>` toggle work changed the relationship from #main to the top-doc docblock so it was no longer a parent relationship but a great-grandparent relationship. This updates the CSS rules that set the heading sizes so they still apply.
Fixes #85389
r? ``@camelid``
|
|
The makes the code for handling "auto-hide" settings more consistent.
|
|
Improve display for "copy-path" button, making it more discreet
As suggested by `@Nemo157` [here](https://github.com/rust-lang/rust/pull/85118#issuecomment-838887670):






r? `@jsha`
|
|
rustdoc: use focus for search navigation
Rather than keeping track of highlighted element inside the JS, take advantage of `.focus()` and the :focus CSS pseudo-class.
This required wrapping each row of results in one big `<a>` tag (because anchors can be focused, but table rows cannot). That in turn required moving from a table layout to a div layout with float.
This makes it so Ctrl+Enter opens links in new tabs, and using the arrow keys to navigate off the bottom of the page scrolls the rest of the page into view. It also simplifies the keyboard event handling. It eliminates the need for click handlers on the search results, and for tracking mouse movements.
This changes the UI treatment of mouse hovering. A hovered element now gets a light grey background, but does not change the focus. It's possible to have two highlighted search results: one that is focused (via keyboard) and one that is hovered (via mouse). Pressing enter will activate the focused link; clicking will activate the hovered link. This matches up with how Firefox and Chrome handle suggestions in their URL bar, and avoids stray mouse movements changing the focus.
Selecting tabs is now done with left/right arrows while any search result is focused. The visibility of results on each search tab is
controlled with the "active" class, rather than by setting display: none directly. Note that the old code kept track of highlighted search element when tabbing back and forth. The new code doesn't.
Demo at https://hoffman-andrews.com/rust/focus-search-results2/std/?search=fn
Fixes #84384
Fixes #79962
Fixes #79872
|
|
|
|
|
|
|
|
|
|
rustdoc: Call `initSidebarItems` in root module of crate
r? `@jsha`
Resolves #85301
|
|
|
|
Fix eslint errors
I cherry-picked the two non-CI commits from #85285.
r? ```@jsha```
|
|
Fix toggle position on mobile
Before:


After:


r? ```@jsha```
|
|
Fix display for "implementors" section
Just saw this problem when going through docs:

This fix puts it back to normal:

You can see it on the `TryFrom` page for example.
r? ```@Nemo157```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Rather than keeping track of highlighted element inside the JS, take
advantage of `.focus()` and the :focus CSS pseudo-class.
This required wrapping each row of results in one big <a> tag (because
anchors can be focused, but table rows cannot). That in turn required
moving from a table layout to a div layout with float.
This makes it so Ctrl+Enter opens links in new tabs, and using the arrow
keys to navigate off the bottom of the page scrolls the rest of the page
into view. It also simplifies the keyboard event handling. It eliminates
the need for click handlers on the search results, and for tracking
mouse movements.
This changes the UI treatment of mouse hovering. A hovered element now
gets a light grey background, but does not change the focused element.
It's possible to have two highlighted search results: one that is
focused (via keyboard) and one that is hovered (via mouse). Pressing
enter will activate the focused link; clicking will activate the hovered
link. This matches up with how Firefox and Chrome handle suggestions in
their URL bar, and avoids stray mouse movements changing the focus.
Selecting tabs is now done with left/right arrows while any search
result is focused. The visibility of results on each search tab is
controlled with the "active" class, rather than by setting display: none
directly. Note that the old code kept track of highlighted search
element when tabbing back and forth. The new code doesn't.
|
|
Rustdoc cleanup
Part of https://github.com/rust-lang/rust/issues/83332. The goal of this PR is to remove a few unused things:
* The "loading content" things are now unneeded.
* Some toggle CSS rules were still there.
* Some parts of the JS had a different indent, fixed it.
r? `@jsha`
|
|
|
|
Fix border radius for doc code blocks in rustdoc
In #85148, I made an invalid change on the border radius of the doc code blocks (look in the top left and bottom left corners of the code blocks).
Before this fix:

After this fix:

r? `@jsha`
|
|
Move global click handlers to per-element ones.
In rustdoc's main.js, we had an onclick handler for the whole document that would dispatch to handlers for various elements. This change attaches the handlers to the elements that trigger them, instead. This simplifies the code and avoids reimplementing the browser's bubbling functionality.
As part of this change, change from a class to an id for help button.
Move the handlers and associated code for highlighting source lines into source-script.js (and factor out a shared regex).
Demo at https://hoffman-andrews.com/rust/bubble-bubble-toil-and-trouble/std/string/struct.String.html
Note: this conflicts with / depends on #85074. Once that's merged I'll rebase this and resolve conflicts.
Part of #83332. Thanks to `@Manishearth` for the [suggestion to not reimplement bubbling](https://github.com/rust-lang/rust/issues/83332#issuecomment-803497509).
r? `@GuillaumeGomez`
|
|
|