Skip to content

Expand hidden/minimized comments when linked directly#9848

Open
Nilex-x wants to merge 5 commits into
refined-github:mainfrom
Nilex-x:expand-hidden-linked-comment
Open

Expand hidden/minimized comments when linked directly#9848
Nilex-x wants to merge 5 commits into
refined-github:mainfrom
Nilex-x:expand-hidden-linked-comment

Conversation

@Nilex-x

@Nilex-x Nilex-x commented Jul 17, 2026

Copy link
Copy Markdown

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:

  • the legacy timeline UI (comments and PR review comments, using '
    Details')
  • the new React-based Issues UI (using the "unfold" button)

Closes #9243

Test URLs

Screenshot

Result test 1:

Screenshot 2026-07-17 at 3 08 56 PM

Result test 2:

Screenshot 2026-07-17 at 3 04 39 PM

Result test 3:

Screenshot 2026-07-17 at 3 09 39 PM

Nilex-x added 2 commits July 17, 2026 14:42
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.
@github-actions github-actions Bot changed the title AI: Expand hidden/minimized comments when linked directly AI SPAM Jul 17, 2026
@github-actions github-actions Bot closed this Jul 17, 2026
@github-actions

Copy link
Copy Markdown

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.

@Nilex-x

Nilex-x commented Jul 17, 2026

Copy link
Copy Markdown
Author

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 recording

Screen.Recording.2026-07-17.at.3.11.23.PM.mov

@fregante fregante reopened this Jul 17, 2026
@fregante fregante changed the title AI SPAM Expand hidden/minimized comments when linked directly Jul 17, 2026
@Nilex-x
Nilex-x marked this pull request as ready for review July 17, 2026 14:46
Comment thread source/features/expand-hidden-linked-comment.tsx Outdated
Comment thread source/features/expand-hidden-linked-comment.tsx Outdated
@fregante
fregante self-requested a review July 17, 2026 16:51
Comment on lines +9 to +17
const id = location.hash.slice(1);
if (!id) {
return;
}

const target = await elementReady(`#${CSS.escape(id)}`, {waitForChildren: false});
if (!target) {
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

there is no need for escaping

Suggested change
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

@SunsetTechuila SunsetTechuila Jul 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// 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

@SunsetTechuila SunsetTechuila Jul 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
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.

@SunsetTechuila SunsetTechuila Jul 19, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be nice to support minimized PR comments on the Files changed tab

https://github.com/refined-github/refined-github/pull/9848/changes#r3611109458

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

Development

Successfully merging this pull request may close these issues.

Expand hidden linked comments

3 participants