about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2024-02-18 05:10:16 +0100
committerGitHub <noreply@github.com>2024-02-18 05:10:16 +0100
commitfb5982f14e5bc943df9f884360562f2aec12ed83 (patch)
tree309fc96ca56be4ece49452160be1ea4ee28c673a /src/librustdoc/html
parent1f8e824f111c972c9df8dbb378d87c33f67bbad4 (diff)
parent5d29f5a6de0cac97c69fd33d81e9063187102741 (diff)
downloadrust-fb5982f14e5bc943df9f884360562f2aec12ed83.tar.gz
rust-fb5982f14e5bc943df9f884360562f2aec12ed83.zip
Rollup merge of #120526 - GuillaumeGomez:mobile-long-crate-name, r=notriddle
rustdoc: Correctly handle long crate names on mobile

Fixes https://github.com/rust-lang/rust/issues/120471.

It now renders like this:

![image](https://github.com/rust-lang/rust/assets/3050060/065b4b8b-ba55-4163-a928-8d7bf735c111)

r? `@notriddle`
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css7
-rw-r--r--src/librustdoc/html/static/js/main.js2
2 files changed, 2 insertions, 7 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index c01a25534f9..9993dfb1d8c 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1941,13 +1941,8 @@ in src-script.js and main.js
 		   pixels to avoid overflowing the topbar when the user sets a bigger
 		   font size. */
 		font-size: 24px;
-	}
-
-	.mobile-topbar h2 a {
-		display: block;
-		text-overflow: ellipsis;
-		overflow: hidden;
 		white-space: nowrap;
+		text-overflow: ellipsis;
 	}
 
 	.mobile-topbar .logo-container > img {
diff --git a/src/librustdoc/html/static/js/main.js b/src/librustdoc/html/static/js/main.js
index b46701b55ea..b26efb75ff6 100644
--- a/src/librustdoc/html/static/js/main.js
+++ b/src/librustdoc/html/static/js/main.js
@@ -45,7 +45,7 @@ function setMobileTopbar() {
         const mobileTitle = document.createElement("h2");
         mobileTitle.className = "location";
         if (hasClass(document.querySelector(".rustdoc"), "crate")) {
-            mobileTitle.innerText = `Crate ${window.currentCrate}`;
+            mobileTitle.innerHTML = `Crate <a href="#">${window.currentCrate}</a>`;
         } else if (locationTitle) {
             mobileTitle.innerHTML = locationTitle.innerHTML;
         }