Skip to content

expand-hidden-linked-comment - New feature - #9848

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

expand-hidden-linked-comment - New feature#9848
Nilex-x wants to merge 11 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 thread source/features/expand-hidden-linked-comment.tsx Outdated
Comment thread source/features/expand-hidden-linked-comment.tsx Outdated
Comment thread source/features/expand-hidden-linked-comment.tsx Outdated
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

Nilex-x and others added 2 commits July 23, 2026 20:28
Co-authored-by: Grigory <grigory.orlov.set@gmail.com>
Co-authored-by: Grigory <grigory.orlov.set@gmail.com>

void features.add(import.meta.url, {
include: [
pageDetect.hasComments,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should probably limit this to the specific views we test and explicitly support. Commits also have comments but I don't want to support them, for example.

There are still a number of unresolved comments suggested by Grigory, I'm turning this into a draft PR until ready

Comment thread readme.md Outdated
Comment thread source/features/expand-hidden-linked-comment.tsx
Comment thread source/features/expand-hidden-linked-comment.tsx Outdated
@fregante
fregante marked this pull request as draft July 25, 2026 08:09
@fregante fregante changed the title Expand hidden/minimized comments when linked directly expand-hidden-linked-comment - New feature Jul 25, 2026
Nilex-x and others added 2 commits July 26, 2026 18:58
Co-authored-by: Grigory <grigory.orlov.set@gmail.com>
elementReady resolves at dom-ready, before comments are loaded, so target
often came back undefined. waitForElement keeps observing past dom-ready,
with a 5s timeout combined with the feature's abort signal.
@fregante
fregante marked this pull request as ready for review July 31, 2026 10:42

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Untested but the code looks good so far

@fregante

Copy link
Copy Markdown
Member

Screenshot updated

Screenshot 11

@fregante

fregante commented Jul 31, 2026

Copy link
Copy Markdown
Member

The only issue I see is that opening the menu will make the comment lose the focus ring, so it does auto-open, but then you're lost again. You can see this in the screenshot above actually.

Maybe we can just restore it via comment.focus(), even if that might trigger an additional scroll.

As expected, PR comments are not affected because we do not use .click()

@fregante

Copy link
Copy Markdown
Member

By the way, I also opened this issue to address the header overlap GitHub bug regardless of expand-hidden-linked-comment:

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Having used a feature a bit, I think losing the focus is worse than having to click to expand a hidden comment, so we can only add this feature if that can be fixed

@fregante
fregante marked this pull request as draft August 7, 2026 06:51
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