diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 5f6f3c65c7ff7..3fee73d6e5d18 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -2435,7 +2435,7 @@ in src-script.js and main.js
}
/* Position of the "[-]" element. */
- details.toggle:not(.top-doc) > summary {
+ details.toggle:not(.top-doc) > summary, .impl-items > section {
margin-left: 10px;
}
.impl-items > details.toggle > summary:not(.hideme)::before,
diff --git a/tests/rustdoc-gui/methods-left-margin.goml b/tests/rustdoc-gui/methods-left-margin.goml
new file mode 100644
index 0000000000000..1003cec33f952
--- /dev/null
+++ b/tests/rustdoc-gui/methods-left-margin.goml
@@ -0,0 +1,19 @@
+// This test is to ensure that methods are correctly aligned on the left side.
+
+go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+
+// First we ensure that we have methods with and without documentation.
+assert: ".impl-items > details.method-toggle > summary > section.method"
+assert: ".impl-items > section.method"
+
+// Checking on desktop.
+set-window-size: (900, 600)
+wait-for-size: ("body", {"width": 900})
+store-position: (".impl-items section.method", {"x": x})
+assert-position: (".impl-items section.method", {"x": |x|}, ALL)
+
+// Checking on mobile.
+set-window-size: (600, 600)
+wait-for-size: ("body", {"width": 600})
+store-position: (".impl-items section.method", {"x": x})
+assert-position: (".impl-items section.method", {"x": |x|}, ALL)
diff --git a/tests/rustdoc-gui/notable-trait.goml b/tests/rustdoc-gui/notable-trait.goml
index b8fa26b17f6b6..e02974e60829a 100644
--- a/tests/rustdoc-gui/notable-trait.goml
+++ b/tests/rustdoc-gui/notable-trait.goml
@@ -84,9 +84,10 @@ call-function: ("check-notable-tooltip-position", {
// Checking on mobile now.
set-window-size: (650, 600)
+wait-for-size: ("body", {"width": 650})
call-function: ("check-notable-tooltip-position-complete", {
- "x": 15,
- "i_x": 293,
+ "x": 25,
+ "i_x": 303,
"popover_x": 0,
})