diff options
| author | bors <bors@rust-lang.org> | 2022-11-19 15:40:04 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-19 15:40:04 +0000 |
| commit | 2a434286a96d61e9f55a3144004beec48206bb29 (patch) | |
| tree | 3d4039fc786f07f1da07322c110b258909d78c18 /src/librustdoc/html/static/js/main.js | |
| parent | 62c627c7a3a9b3e193a5ae6e1ec7348bc5136301 (diff) | |
| parent | f69f4cb19cb315537b40468d061579f43b62dd8f (diff) | |
| download | rust-2a434286a96d61e9f55a3144004beec48206bb29.tar.gz rust-2a434286a96d61e9f55a3144004beec48206bb29.zip | |
Auto merge of #104607 - matthiaskrgr:rollup-9s589me, r=matthiaskrgr
Rollup of 10 pull requests Successful merges: - #103117 (Use `IsTerminal` in place of `atty`) - #103969 (Partial support for running UI tests with `download-rustc`) - #103989 (Fix build of std for thumbv7a-pc-windows-msvc) - #104076 (fix sysroot issue which appears for ci downloaded rustc) - #104469 (Make "long type" printing type aware and trim types in E0275) - #104497 (detect () to avoid redundant <> suggestion for type) - #104577 (Don't focus on notable trait parent when hiding it) - #104587 (Update cargo) - #104593 (Improve spans for RPITIT object-safety errors) - #104604 (Migrate top buttons style to CSS variables) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static/js/main.js')
| -rw-r--r-- | src/librustdoc/html/static/js/main.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js index 874f130d7e2..75b3dce2eda 100644 --- a/src/librustdoc/html/static/js/main.js +++ b/src/librustdoc/html/static/js/main.js @@ -795,7 +795,7 @@ function loadCss(cssUrl) { // This means when the window is resized, we need to redo the layout. const base = window.CURRENT_NOTABLE_ELEMENT.NOTABLE_BASE; const force_visible = base.NOTABLE_FORCE_VISIBLE; - hideNotable(); + hideNotable(false); if (force_visible) { showNotable(base); base.NOTABLE_FORCE_VISIBLE = true; @@ -846,7 +846,7 @@ function loadCss(cssUrl) { // Make this function idempotent. return; } - hideNotable(); + hideNotable(false); const ty = e.getAttribute("data-ty"); const wrapper = document.createElement("div"); wrapper.innerHTML = "<div class=\"docblock\">" + window.NOTABLE_TRAITS[ty] + "</div>"; @@ -883,7 +883,7 @@ function loadCss(cssUrl) { return; } if (!e.NOTABLE_FORCE_VISIBLE && !elemIsInParent(event.relatedTarget, e)) { - hideNotable(); + hideNotable(true); } }; } @@ -903,14 +903,16 @@ function loadCss(cssUrl) { // To work around this, make sure the click finishes being dispatched before // hiding the popover. Since `hideNotable()` is idempotent, this makes Safari behave // consistently with the other two. - setTimeout(hideNotable, 0); + setTimeout(() => hideNotable(false), 0); } } - function hideNotable() { + function hideNotable(focus) { if (window.CURRENT_NOTABLE_ELEMENT) { if (window.CURRENT_NOTABLE_ELEMENT.NOTABLE_BASE.NOTABLE_FORCE_VISIBLE) { - window.CURRENT_NOTABLE_ELEMENT.NOTABLE_BASE.focus(); + if (focus) { + window.CURRENT_NOTABLE_ELEMENT.NOTABLE_BASE.focus(); + } window.CURRENT_NOTABLE_ELEMENT.NOTABLE_BASE.NOTABLE_FORCE_VISIBLE = false; } const body = document.getElementsByTagName("body")[0]; @@ -923,7 +925,7 @@ function loadCss(cssUrl) { e.onclick = function() { this.NOTABLE_FORCE_VISIBLE = this.NOTABLE_FORCE_VISIBLE ? false : true; if (window.CURRENT_NOTABLE_ELEMENT && !this.NOTABLE_FORCE_VISIBLE) { - hideNotable(); + hideNotable(true); } else { showNotable(this); window.CURRENT_NOTABLE_ELEMENT.setAttribute("tabindex", "0"); @@ -946,7 +948,7 @@ function loadCss(cssUrl) { } if (!this.NOTABLE_FORCE_VISIBLE && !elemIsInParent(event.relatedTarget, window.CURRENT_NOTABLE_ELEMENT)) { - hideNotable(); + hideNotable(true); } }; }); @@ -1057,7 +1059,7 @@ function loadCss(cssUrl) { onEachLazy(document.querySelectorAll(".search-form .popover"), elem => { elem.style.display = "none"; }); - hideNotable(); + hideNotable(false); }; /** |
