Skip to content

Conversation

@GuillaumeGomez
Copy link
Member

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the § anchor of the tcx method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid

@rustbot
Copy link
Collaborator

rustbot commented Jan 8, 2026

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @lolbinarycat

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jan 8, 2026
@rust-log-analyzer

This comment has been minimized.

Comment on lines 56 to 58
// Now we move the cursor to the anchor to check there is no gap between the method and the
// anchor, making the anchor disappear and preventing users to click on it.
move-cursor-to: "#method\.vroum .anchor"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this cursor move accomplished instantaneously, or does it move realistically in a gradual way? Ideally we'd make sure that even if it's done slowly, the anchor doesn't disappear.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instantly. But moving at a given speed could be interesting. Gonna need to add this option in browser-ui-test.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the instantaneous move is why we haven't been able to successfully test this before? Could you check if this new test fails without your CSS fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum yeah it still passes. Not fun... :-/

@camelid camelid added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 8, 2026
@GuillaumeGomez
Copy link
Member Author

Found a way! I instead move the cursor just a bit left to the method. Failed without the fix, works with it. So all good. =D

I added a comment explaining that too.

Copy link
Member

@camelid camelid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@camelid
Copy link
Member

camelid commented Jan 8, 2026

@bors r+ rollup

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 8, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 8, 2026

📌 Commit 16fbf6a has been approved by camelid

It is now in the queue for this repository.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 9, 2026
Fix trait method anchor disappearing before user can click on it

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the `§` anchor of the `tcx` method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 9, 2026
Fix trait method anchor disappearing before user can click on it

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the `§` anchor of the `tcx` method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 9, 2026
Fix trait method anchor disappearing before user can click on it

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the `§` anchor of the `tcx` method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid
rust-bors bot added a commit that referenced this pull request Jan 9, 2026
Rollup of 11 pull requests

Successful merges:

 - #150272 (docs(core): update `find()` and `rfind()` examples)
 - #150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions)
 - #150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`)
 - #150574 (Clarify `MoveData::init_loc_map`.)
 - #150762 (Use functions more in rustdoc GUI tests)
 - #150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`)
 - #150816 (Fix trait method anchor disappearing before user can click on it)
 - #150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed))
 - #150829 (make attrs actually use `Target::GenericParam`)
 - #150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`)
 - #150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.)

r? @ghost
@rust-bors rust-bors bot merged commit fe307c5 into rust-lang:main Jan 9, 2026
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Jan 9, 2026
rust-timer added a commit that referenced this pull request Jan 9, 2026
Rollup merge of #150816 - method-anchor, r=camelid

Fix trait method anchor disappearing before user can click on it

A good example of this bug is going to https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/struct.ItemCtxt.html#impl-HirTyLowerer%3C'tcx%3E-for-ItemCtxt%3C'tcx%3E, and then try to click on the `§` anchor of the `tcx` method.

The solution to this bug is to simply "glue" the anchor to the method, so when the mouse cursor moves to it, there is no gap between the two, preventing the anchor to disappear (hopefully this explanation doesn't make sense only to me ^^').

First commit fixes the bug by expanding the anchor size.
Second commit is a small clean-up of the GUI test.
Third commit actually adds the GUI regression test.

cc @BoxyUwU
r? @camelid
@GuillaumeGomez GuillaumeGomez deleted the method-anchor branch January 9, 2026 15:36
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Jan 12, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#150272 (docs(core): update `find()` and `rfind()` examples)
 - rust-lang/rust#150385 (fix `Expr::can_have_side_effects` for `[x; N]` style array literal and binary expressions)
 - rust-lang/rust#150561 (Finish transition from `semitransparent` to `semiopaque` for `rustc_macro_transparency`)
 - rust-lang/rust#150574 (Clarify `MoveData::init_loc_map`.)
 - rust-lang/rust#150762 (Use functions more in rustdoc GUI tests)
 - rust-lang/rust#150808 (rename the `derive_{eq, clone_copy}` features to `*_internals`)
 - rust-lang/rust#150816 (Fix trait method anchor disappearing before user can click on it)
 - rust-lang/rust#150821 (tests/ui/borrowck/issue-92157.rs: Remove (bug not fixed))
 - rust-lang/rust#150829 (make attrs actually use `Target::GenericParam`)
 - rust-lang/rust#150834 (Add tracking issue for `feature(multiple_supertrait_upcastable)`)
 - rust-lang/rust#150864 (The aarch64-unknown-none target requires NEON, so the docs were wrong.)

r? @ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants