Expand hidden/minimized comments when linked directly#9848
Conversation
Following a permalink to a hidden comment (spam, off-topic, resolved, outdated, etc.) left it collapsed behind a "Show comment" toggle in both the legacy timeline UI and the new React-based Issues UI. Now the targeted comment is expanded and scrolled into view automatically.
The generic \`details\` selector also matched unrelated dropdowns (the "..." menu, reactions popover) on regular comments, opening them by mistake when linking directly to a normal comment. Scope the lookup to the minimized-comment header instead, matching the selector already used by preview-hidden-comments.
|
This looks like an AI-generated PR, so we're preemptively closing it. If you're human and tested it, include a screenshot/video/gif of the working PR and we can reopen the PR. Don't open more PRs until this one is resolved. |
|
Hi, I'm human and did test this manually against the sandbox test URLs listed in the PR description before opening it:
I loaded the built extension unpacked in Chrome and verified the hidden comment expands automatically on each, and that it doesn't affect regular (non-hidden) comments. Screenshots are in the PR description, and I've added a screen recording above showing it working live. Screen recordingScreen.Recording.2026-07-17.at.3.11.23.PM.mov |
| const id = location.hash.slice(1); | ||
| if (!id) { | ||
| return; | ||
| } | ||
|
|
||
| const target = await elementReady(`#${CSS.escape(id)}`, {waitForChildren: false}); | ||
| if (!target) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
there is no need for escaping
| const id = location.hash.slice(1); | |
| if (!id) { | |
| return; | |
| } | |
| const target = await elementReady(`#${CSS.escape(id)}`, {waitForChildren: false}); | |
| if (!target) { | |
| return; | |
| } | |
| const id = location.hash; | |
| if (!id) { | |
| return; | |
| } | |
| const target = await elementReady(id, {waitForChildren: false}); | |
| if (!target) { | |
| return; | |
| } |
| return; | ||
| } | ||
|
|
||
| // New React-based Issues UI |
There was a problem hiding this comment.
| // New React-based Issues UI | |
| // React-based UI |
It's hardly new and it's used for PRs too
|
|
||
| Legacy timeline UI, hidden comment: https://github.com/refined-github/sandbox/pull/47#issuecomment-1257136170 | ||
| Legacy timeline UI, hidden review comment: https://github.com/refined-github/sandbox/pull/47#discussion_r979366049 | ||
| New Issues UI, hidden comment: https://github.com/refined-github/sandbox/issues/131#issuecomment-4297544223 |
There was a problem hiding this comment.
| New Issues UI, hidden comment: https://github.com/refined-github/sandbox/issues/131#issuecomment-4297544223 | |
| Hidden issue comment: https://github.com/refined-github/sandbox/issues/131#issuecomment-4297544223 |
| return; | ||
| } | ||
|
|
||
| // TODO [2027-01-01]: Old timeline UI, drop |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Would be nice to support minimized PR comments on the Files changed tab
https://github.com/refined-github/refined-github/pull/9848/changes#r3611109458
Following a permalink to a hidden/minimized comment (marked as spam, off-topic, resolved, outdated, or abuse) leaves it collapsed behind a "Show comment" toggle instead of revealing it — the linked-to content stays invisible even though the page scrolls to it.
This adds a feature that detects when the URL hash targets a hidden comment and automatically expands it, in both:
Details
')Closes #9243
Test URLs
preview-hidden-commentstest PR sandbox#47 (comment) — hidden PR comment expands automaticallypreview-hidden-commentstest PR sandbox#47 (comment) — hidden review comment expands and is scrolled into viewScreenshot
Result test 1:
Result test 2:
Result test 3: