Skip to content

small-user-avatars - Restore on new PR lists - #10080

Merged
fregante merged 8 commits into
refined-github:mainfrom
IdrisGit:fix-small-user-avatars-new-pr-lists
Sep 14, 2026
Merged

fregante merged 8 commits into
refined-github:mainfrom
IdrisGit:fix-small-user-avatars-new-pr-lists

Conversation

@IdrisGit

Copy link
Copy Markdown
Contributor

Split out of #10072 as requested, so each feature gets its own release note.

Restores small avatars on the new PR lists' author links, plus the global issue lists that use the same [data-testid="author-filter-link"] element. On global issue lists that element wraps a visually-hidden "Filter by author " label, so the username is read from data-hovercard-url when available.

Follow-up to #10065.

Test URLs

Screenshot

Repository PR list (Preview) with author avatars Global issue list (Assigned to me) with author avatars

Comment thread source/features/small-user-avatars.tsx Outdated
function addAvatar(link: HTMLElement): void {
const username = link.textContent;
const hovercardUrl = link.getAttribute('data-hovercard-url');
const username = hovercardUrl ? hovercardUrl.split('/', 3)[2] : link.textContent;

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.

I'm curious why this should be needed. The selected item still contains the username, does it not?

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.

I'm seeing this on https://github.com/pulls/authored for link.textContent

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The issue is not on the global PR list it's on the global issue lists do. Every author button there looks like this:

<button data-testid="author-filter-link" data-hovercard-url="/users/0xShinRai/hovercard" data-hovercard-type="user">
	<span class="prc-VisuallyHidden-...">Filter by author </span>0xShinRai
</button>
image

This is what happens when the hover card check is removed (tested locally)

image

And this with the hover card parsing

image

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.

Thanks! I'd love this to be detailed in the code.

  1. move the getter into a "extractUsername(el)` function
  2. Add a link to your own comment to the function as an explanation
  3. It would also be great to add an internal assertion to ensure that the extracted username is valid (no spaces for example)

For the third point, we might already have some helper or logic in related functions. If not, feel free to create one in github-helpers/index.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread source/features/small-user-avatars.tsx Outdated
Comment thread source/features/small-user-avatars.tsx Outdated
'[data-testid="created-at"]',
'[data-testid="closed-at"]',
) + ' a[data-hovercard-url*="/users"]', // `isIssueList`
'[data-testid="author-filter-link"][aria-label^="Filter by author "]:not([aria-label$="[bot]"])', // Preview and global PR lists

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.

Why exclude the bot? We don't have this exclusion elsewhere. Can you provide a test URL where this makes a difference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Bot author links have no user hovercard, so the existing selectors never matched them and on the issue lists that's why they had no avatar.

On the new PR list dependabot[bot] is skipped by the data-hovercard-type selector for the same reason. The PR list is the only place where a bot link has an aria-label, which is also the attribute we need for attributed-author-filter-link, so :not([aria-label$="[bot]"]) keeps it matching the other lists instead of adding a new rule.

PR list with bot authors without the exclusion selector (locally tested)

screenshot-2026-09-12_22-28-38

PR list with bot authors with the exclusion selector (locally tested)

image

Test URLs:

https://github.com/pulls/search?q=is%3Apr+author%3Aapp%2Fdependabot+state%3Aopen
https://github.com/issues/search?q=is%3Aissue+author%3Aapp%2Fgithub-actions
https://github.com/mf4633/low-no/issues?q=sort%3Aupdated-desc+is%3Aissue+state%3Aopen+

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.

If the limitation is the presence of the hovercard, then we should select the hovercard rather than building a blacklist

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am sorry but GitHub has done GitHub and hovercard* is only present on Issue Lists but absent on PR Lists, so there's nothing to target hovercard there.

*The hovercard isn't an element, just a data-hovercard-url attribute, added by GitHub to dynamically fetch the user's profile card/modal.

@fregante fregante Sep 13, 2026 •

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.

The comment suggests that this selector only applies to PR lists, so I'm not sure why Issue lists are relevant here.

It can be changed to

		'[aria-label^="Filter by author "][data-hovercard-url]', // Preview and global PR lists

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I think I misworded it. There are two separate questions here: 1. which selector to use, and 2. whether we need the bot exclusion.

1 which selector to use

  • Issue List author elements HAVE data-hovercard-url.
  • PR List author elements DOESN'T HAVE data-hovercard-url, so the suggested selector matches nothing, including human authors.
  • We therefore need:
'[aria-label^="Filter by author "]'

2 whether we need the bot exclusion

The bot exclusion selector is optional:

:not([aria-label$="[bot]"])

I added it to preserve the behaviour I observed on issue lists, where the existing hovercard selectors skip app authors.

However, this is a best-effort exclusion: it skips names ending in [bot], such as dependabot[bot], but not bare app names such as Copilot, which already gets an avatar.
If showing bot avatars is preferred I am happy to remove the exclusion selector.

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.

Ah I had misread your comment.

Don't we have a function to get the avatar for apps too? As long as it works and doesn't duplicate any existing avatars I don't see why not support it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In the latest push I have added support for it and updated the avatar lookup for a few more bots.

@IdrisGit

Copy link
Copy Markdown
Contributor Author

I will look into the comments, I was testing alot of things that got messed up in the Preview UI and I am using the downloaded/copied HTML for the work.

I will do cleanup on my local, reverify everything.

@IdrisGit
IdrisGit requested a review from fregante September 12, 2026 17:03
@fregante

Copy link
Copy Markdown
Member

#10080 (comment)

@fregante
fregante merged commit a648cdc into refined-github:main Sep 14, 2026
14 checks passed
@github-actions

Copy link
Copy Markdown

To maintainers: Please add labels to this PR

@fregante

Copy link
Copy Markdown
Member

Thank you! I'll open a followup PR to further improve the logic and support for bots. It's kind of a mess at the moment because there's no one-fetch URL for app/bot avatars. Also GitHub calls them in two different ways:

and a million DOM variations...

@IdrisGit

Copy link
Copy Markdown
Contributor Author

also I have found that the new Preview screens are also very inconsistent, I will try to file detailed issues as I find them 👍🏼

@fregante

Copy link
Copy Markdown
Member

It's possible that it's just too early and that we shouldn't spend time on them yet. Most likely they'll add the hovercard attribute at some point.

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

Labels

Development

Successfully merging this pull request may close these issues.

2 participants