Skip to content

Sticky header for issue / PR / discussion comments #8463

Closed

Description

@karlhorky

Hi @fregante, hope everything is good with you! 👋

Description

For long comments on issues, PRs and discussions, I was wondering if there would be any appetite for Refined GitHub to have a sticky header for quick access to common features without scrolling up to the top of the comment (editing the comment, linking to the comment, navigating to the commenter's GitHub profile, anything else in the three dots menu).

It would mean that there would be 2 sticky headers, although the comment header is not very tall.

I would find this personally useful when making many updates to long comments, where I want to visually see the bottom of the comment, but quickly be able to edit the comment.

Example URLs

Mockup

Screen.Recording.2025-06-02.at.10.33.48.mov

Activity

  1. fregante commented on Jun 16, 2025

    @fregante
    Member

    I'd accept a small PR for this, separate CSS-only feature. However it needs to handle:

    • that bar
    • mobile view (should be the same)
    • notification bar
    • automatically adjust when the notification bar is closed

    We have some other feature that handles the notification header height, I think sticky-sidebar, so you should be able to piggy-back on its logic or copy-paste its selector.

    However it should still only be CSS only and avoid broad :has() usage (e.g. body:has())

  2. added
    small
    and removed on Jun 16, 2025
  3. changed the title [-]Sticky header for issue / PR / discussion comments?[/-] [+]Sticky header for issue / PR / discussion comments[/+] on Jun 16, 2025
  4. Vangelis66 commented on Jul 12, 2025

    @Vangelis66
  5. fregante commented on Jul 20, 2025

    @fregante
    Member

    @karlhorky maybe in a future where we only have one React view to support and they have acceptable classes, this can be implemented.

    Judging by the verbose selectors in the attempted PR, this feature would be broken in about 9 days and create performance issues in 17 days.

  6. fregante commented on Jul 20, 2025

    @fregante
    Member

    Those interested can attempt to copy-paste it @SunsetTechuila's CSS and ride it while it works.

  7. karlhorky commented on Jul 20, 2025

    @karlhorky
    ContributorAuthor

    Ahh too bad :( Well let's hope for that future then.

    Current CSS Solution

    I'll try out the Refined GitHub "Custom CSS" feature with my modified version of CSS below (changes: set background to gray to avoid transparency, z-index fixes for videos, fix weird Biome CSS formatting) from @SunsetTechuila's PR #8544 :

    /* https://github.com/refined-github/refined-github/issues/8463#issuecomment-3094626175 */
    
    /* Issue body header */
    [class^="IssueBodyHeader-module__IssueBodyHeaderContainer"],
    /* Issue comment header */
    [data-testid='comment-header'],
    /* PR body/comment header */
    .timeline-comment-header {
    	position: sticky;
    	top: calc(var(--base-sticky-header-height, 0px) + 56px);
    	z-index: 3;
    	background: var(--bgColor-muted, var(--color-canvas-subtle)) !important;
    }
    
    [id^="gistcomment"] .timeline-comment-header {
    	top: 0;
    }
    
    /* Show menus on top of headers */
    .js-comment-container:has(details[open]) .timeline-comment-header {
    	z-index: 4;
    }
    
    [class^="IssueBodyHeader-module__IssueBodyHeaderContainer"],
    [data-testid="comment-header"] {
    	border-radius: 0;
    }
    
    /* Issue body container */
    [data-testid="issue-body"] [class^="Box"]:has(> #issue-body-viewer),
    /* Issue comment container */
    [class^="IssueCommentViewer-module__IssueCommentContent"] {
    	border-radius: var(--borderRadius-medium);
    	overflow: clip;
    }
    
    @supports (anchor-name: --test) {
    	[app-name="issues-react"] {
    		[class*="ActivityHeader-module__activityHeader"]
    			button[aria-haspopup="true"][aria-expanded="true"] {
    			anchor-name: --header;
    		}
    
    		[class^="prc-Overlay-Overlay"][data-variant="anchored"]:has(
    				.octicon-quote,
    				[class*="scrollableEditHistoryList"]
    			) {
    			position: fixed !important;
    			position-anchor: --header;
    			top: anchor(bottom) !important;
    		}
    	}
    }

    Also added to my GitHub Tricks repo here: https://github.com/karlhorky/github-tricks#refined-github-sticky-comment-headers

    Since I pasted this like 5 minutes ago, it's already delivering value! Already interacted intuitively with the sticky headers like 3 times.

    I'll report back to this issue with any problems I encounter over time, including any fixes I make to the CSS. Maybe if we see a longer period of stability (or a change which makes the approach nicer), we can reconsider making this a feature again.

  8. fregante commented on Jul 20, 2025

    @fregante
    Member

    rgh-OFF-sticky-comment-header doesn't exist so you might want to remove that. Thanks for sharing!

  9. karlhorky commented on Jul 21, 2025

    @karlhorky
    ContributorAuthor

    Stability updates for the CSS solution

    • 15 Sep 2025: No visible problems
    • 21 Jul 2025: No visible problems

    Testing Methodology for the CSS solution

    1. Go to issue Type Stripping in node_modules/*/*.ts nodejs/typescript#14 and check for any visual bugs
    2. Go to PR Replace Create React App recommendation with Vite reactjs/react.dev#5487 (comment) and check for any visual bugs
  10. 15 remaining items

  11. SunsetTechuila commented on Sep 16, 2025

    @SunsetTechuila
    Contributor

    The only thing the code inside the "supports" block does is make context menus sticky

    And it is broken since the menu element is no longer a child of [app-name="issues-react"]

  12. karlhorky commented on Sep 17, 2025

    @karlhorky
    ContributorAuthor

    @SunsetTechuila would you be open to creating a new PR for this? I think you should get the credit for this.

  13. karlhorky commented on Sep 29, 2025

    @karlhorky
    ContributorAuthor

    @SunsetTechuila do you think that you would have time to open this PR?

  14. SunsetTechuila commented on Sep 29, 2025

    @SunsetTechuila
    Contributor

    yes

  15. SunsetTechuila commented on Oct 7, 2025

    @SunsetTechuila
    Contributor

    github is actively changing stuff, so I won't rush it

  16. SunsetTechuila commented on Oct 13, 2025

    @SunsetTechuila
    Contributor

    And it is broken since the menu element is no longer a child of [app-name="issues-react"]

    This part has to go. I don't see any css-only way to detect the issue page without using body:has

  17. karlhorky commented on Oct 13, 2025

    @karlhorky
    ContributorAuthor

    @SunsetTechuila what do you mean? which feature is broken?

    If you mean the feature of the menu scrolling with the header once it's open, I can confirm that's the case (see the space in between the menu items and the three dots):

    Image

    But at least, it opens in the right place:

    Image
  18. SunsetTechuila commented on Oct 13, 2025

    @SunsetTechuila
    Contributor

    If you mean the feature of the menu scrolling with the header once it's open

    Yes

  19. karlhorky commented on Oct 26, 2025

    @karlhorky
    ContributorAuthor

    @fregante since this feature is planned to be implemented, could this issue be reopened again?

  20. fregante commented on Oct 26, 2025

    @fregante
    Member

    3 months of planning and no PR in sight. As far as I'm concerned, the feature is not coming. No point in tracking an impossible and already-attempted feature. Half of Refined GitHub's feature are broken or about to be broken, so I'm not in a rush to add complex features and spend hours reviewing PRs for new features.

  21. karlhorky commented on Oct 26, 2025

    @karlhorky
    ContributorAuthor

    Hmm I understand your hesitation, but the 3 months of planning is not accurate, I think. Most of the work was done by @SunsetTechuila within approximately 15 days in July (including back and forth with PR review). The rest of the time since then has been spent on trying it out live on GitHub, where it has not been problematic over this period of time.

    The base CSS for this feature is not overly complex, but it would be good to get it right without incompatibilities - which is in my understanding one reason @SunsetTechuila is delaying.

    But I get what you mean that you would like to first see a PR - I'm assuming you mean it would be better to wait for @SunsetTechuila to be available / ready again before reopening this issue.

  22. SunsetTechuila commented on Oct 27, 2025

    @SunsetTechuila
    Contributor

    I'll open a PR today

  23. karlhorky commented on Aug 31, 2026

    @karlhorky
    ContributorAuthor

    This feature was eventually dropped, because of compatibility problems:

    The latest versions of the CSS and discussion (and any future supported extension or user styles) will happen over there.

  24. locked as resolved and limited conversation to collaborators on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedenhancementsmall

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions