Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
52b8f65
`sticky-comment-header` - New feature
SunsetTechuila Jul 7, 2025
f5df164
fix file extension
SunsetTechuila Jul 7, 2025
8e25a41
finalize
SunsetTechuila Jul 8, 2025
394dcba
Add CSS property to sticky comment header feature
SunsetTechuila Jul 8, 2025
1d6708b
format with biome
SunsetTechuila Jul 8, 2025
aba4c85
add test url
SunsetTechuila Jul 8, 2025
3b7e21d
test urls
SunsetTechuila Jul 8, 2025
c1331d3
add comments
SunsetTechuila Jul 8, 2025
9725e44
make menu sticky with css anchor props
SunsetTechuila Jul 11, 2025
e68bb77
fix pr comment menus being clipped
SunsetTechuila Jul 11, 2025
bc5a351
format
SunsetTechuila Jul 11, 2025
ec2ce58
target specific menus
SunsetTechuila Jul 12, 2025
b4660ed
fix menus going under the next header
SunsetTechuila Jul 12, 2025
1e73d1f
update issue description header selector
SunsetTechuila Jul 16, 2025
fc3a7e8
update issue description header selector 2
SunsetTechuila Jul 16, 2025
a414a49
update styles
SunsetTechuila Jul 18, 2025
7b1527a
update comments for issue and PR body header selectors
SunsetTechuila Jul 18, 2025
2cbc763
use `sticky-comment-header` to mark user's own comments
SunsetTechuila Jul 18, 2025
5a2c824
use fuchsia as a fallback
SunsetTechuila Jul 18, 2025
a3b223a
remove outdated comment
SunsetTechuila Jul 18, 2025
1697302
correct selector comment
SunsetTechuila Jul 18, 2025
99d4289
`rgh-user-own-comment` -> `rgh-viewer-did-author`
SunsetTechuila Jul 18, 2025
04b5ad6
sync feature descriptions
SunsetTechuila Jul 18, 2025
b041a2d
inline `background` css variable
SunsetTechuila Jul 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build/__snapshots__/features-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,12 @@
"description": "Lets you subscribe to opening/closing events of issues in one click.",
"screenshot": "https://github-production-user-asset-6210df.s3.amazonaws.com/1402241/238186901-cbc98b51-d173-40c6-b21e-5f0bae3d800c.png"
},
{
"id": "sticky-comment-header",
"description": "Makes the comment header sticky when scrolling through long comments. Requires `show-names` to be enabled.",
"css": true,
"screenshot": null
},
{
"id": "sticky-conversation-list-toolbar",
"description": "Makes the issue/PR list’s filters toolbar sticky.",
Expand Down
1 change: 1 addition & 0 deletions build/__snapshots__/imported-features.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
"small-user-avatars",
"sort-conversations-by-update-time",
"status-subscription",
"sticky-comment-header",
"sticky-sidebar",
"stop-redirecting-in-notification-bar",
"suggest-commit-title-limit",
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ https://github.com/refined-github/refined-github/wiki/Contributing#metadata-guid
- [](# "expand-all-hidden-comments") [On long conversations where GitHub hides comments under a "N hidden items. Load more...", alt-clicking it will load up to 200 comments at once instead of 60.](https://github-production-user-asset-6210df.s3.amazonaws.com/83146190/261160123-9c4f894b-38c0-446f-af50-9beca7ff1f74.png)
- [](# "keyboard-navigation") [Adds shortcuts to issues, PRs conversations, and PR file lists: <kbd>j</kbd> focuses the comment/file below; <kbd>k</kbd> focuses the comment/file above.](https://user-images.githubusercontent.com/1402241/86573176-48665900-bf74-11ea-8996-a5c46cb7bdfd.gif)
- [](# "comment-excess") [Informs you that there are hidden comments in the header of long issues. Also scrolls down to the hidden comments when pressing Cmd+F or Ctrl+F.](https://github.com/refined-github/refined-github/assets/1402241/4e4660f9-c987-4b0d-82ca-56ef29952c31)
- [](# "sticky-comment-header") Makes the comment header sticky when scrolling through long comments. Requires `show-names` to be enabled.

<!--
Refer to style guide in the wiki. Keep this message between sections.
Expand Down
12 changes: 11 additions & 1 deletion source/features/show-names.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@ function appendName(element: HTMLAnchorElement, fullName: string): void {

async function updateLinks(found: HTMLAnchorElement[]): Promise<void> {
const users = Map.groupBy(found, element => element.textContent.trim());
users.delete(getUsername()!);

const currentUser = getUsername()!;
const currentUserElements = users.get(currentUser);
if (currentUserElements) {
for (const currentUserElement of currentUserElements) {
// mark viewer's own comments on the issue page for `sticky-comment-header`
currentUserElement.closest('[data-testid="comment-header"]')?.classList.add('rgh-viewer-did-author');
}
users.delete(currentUser);
}

users.delete('ghost'); // Consider using `github-reserved-names` if more exclusions are needed

if (users.size === 0) {
Expand Down
55 changes: 55 additions & 0 deletions source/features/sticky-comment-header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
html:not([rgh-OFF-sticky-comment-header]) {
/* 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);
Comment thread
SunsetTechuila marked this conversation as resolved.
Resolved
z-index: 1;
}

/* Added by `show-names` */
.rgh-viewer-did-author,
.timeline-comment.current-user .timeline-comment-header,
[class*="IssueBodyHeader-module__viewerDidAuthor"] {
background: linear-gradient(var(--bgColor-accent-muted, fuchsia)), var(--rgh-background) !important;
Comment thread
SunsetTechuila marked this conversation as resolved.
Resolved
}

/* Show menus on top of headers */
.js-timeline-item:has(details:open) .timeline-comment-header {
z-index: 2;
}
Comment thread
SunsetTechuila marked this conversation as resolved.
Resolved

[class^="IssueBodyHeader-module__IssueBodyHeaderContainer"],
[data-testid="comment-header"] {
border-radius: 0;
}

/* Issue body container */
[data-testid="issue-body"] [class^="Box"]:has(> #issue-body-viewer),

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.

@kovsu it feels like we just dropped a selector just like this (box:has) because it was causing perf issues.

/* 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;
}
}
}
}
14 changes: 14 additions & 0 deletions source/features/sticky-comment-header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import './sticky-comment-header.css';

import features from '../feature-manager.js';

void features.addCssFeature(import.meta.url);
Comment thread
SunsetTechuila marked this conversation as resolved.
Resolved

/*

Test URLs:

https://github.com/refined-github/sandbox/issues/117
https://github.com/refined-github/sandbox/pull/118

*/
1 change: 1 addition & 0 deletions source/refined-github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import './features/align-issue-labels.js';
import './features/clean-pinned-issues.js';
import './features/hide-diff-signs.js';
import './features/clean-rich-text-editor.js';
import './features/sticky-comment-header.js';

// Disableable features
import './features/useful-not-found-page.js';
Expand Down