diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index 28df8d3f011fe..531c20a4f7b5f 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1036,7 +1036,7 @@ table, } /* pseudo-element for holding the dropdown-arrow image; needs to be a separate thing so that we can apply CSS-filters to change the arrow color in themes */ -#crate-search-div::after { +#crate-search::after { /* lets clicks through! */ pointer-events: none; /* completely covers the underlying div */ @@ -1669,6 +1669,28 @@ a.tooltip:hover::after { font-weight: normal; } +/* panel that only shows up during searches */ +#search-focus-panel { + position: absolute; + display: none; + background-color: var(--main-background-color); + border-width: 1px; + border-color: var(--border-color); + border-style: solid; + padding: 3px; + text-wrap: nowrap; + z-index: 1; + top: 0; +} + +rustdoc-search { + position: relative; +} + +rustdoc-search:focus-within #search-focus-panel { + display: block; +} + #src-sidebar { width: 100%; overflow: auto; diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index be0ec425946c2..4e8bc6d5047f4 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -2760,7 +2760,7 @@ ${item.displayPath}${name}\ * @param {boolean} go_to_first * @param {string} filterCrates */ - async function showResults(results, go_to_first, filterCrates) { + async function showResults(results, go_to_first, _filterCrates) { const search = searchState.outputElement(); if (go_to_first || (results.others.length === 1 && getSettingValue("go-to-only-result") === "true") @@ -2815,17 +2815,7 @@ ${item.displayPath}${name}\ } } - let crates = ""; - if (rawSearchIndex.size > 1) { - crates = " in
"; - } - - let output = `