Skip to content

new-or-deleted-file- Improve compatibility with "Material Icons for GitHub" - #9110

Closed
SunsetTechuila wants to merge 5 commits into
mainfrom
quick-edit-icons
Closed

SunsetTechuila wants to merge 5 commits into
mainfrom
quick-edit-icons

Conversation

@SunsetTechuila

@SunsetTechuila SunsetTechuila commented Mar 22, 2026 •

Copy link
Copy Markdown
Contributor

Initially, I intended to fix compatibility with the "GitHub File Icons" extension; however, it cannot be fixed on our side alone, and the extension is unmaintained. Material Icons for GitHub looks nicer anyway.

Test URLs

https://github.com/refined-github/sandbox/pull/71/changes

Screenshot

Before:

image

After:

image

@SunsetTechuila SunsetTechuila changed the title quick-file-edit - Improve compatibility with "GitHub File Icons" extension Meta: Simplify directory listing file icon selector Mar 22, 2026
@SunsetTechuila SunsetTechuila added the meta Related to Refined GitHub itself label Mar 22, 2026
@fregante

Copy link
Copy Markdown
Member

Mergeable?

'.react-directory-filename-column > :is(svg, img).color-fg-muted',
'.js-navigation-container .octicon-file',
];
export const directoryListingFileIcon = '.react-directory-filename-column > .octicon-file';

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.

This is just a cleanup

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.

Do send this as a standalone PR or sneak it into a related PR if it doesn't change anything at runtime.

@SunsetTechuila SunsetTechuila changed the title Meta: Simplify directory listing file icon selector Improve compatibility with "Material Icons for GitHub" May 2, 2026
@SunsetTechuila SunsetTechuila changed the title Improve compatibility with "Material Icons for GitHub" new-or-deleted-file- Improve compatibility with "Material Icons for GitHub" May 2, 2026
@fregante

fregante commented May 2, 2026 •

Copy link
Copy Markdown
Member

Re: compat with other extensions.

I sent PRs to many such extensions over the year, it's often better for them to replace the icons correctly than for us to "support" them all. As long as they replace the SVG without messing the classes up, it doesn't really matter if the SVG is at one level or wrapped in a a.

  1. Our extension wraps the icon, whatever it is
  2. Their extension replaces the icon, wherever it is

We should probably write this "rule" in the feature's source code.

@SunsetTechuila

SunsetTechuila commented May 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Are there more than 2 extensions that I mentioned, one of which is unmaintained?

The problems with "Material Icons for GitHub" are:

  1. It copies all properties, including the .octicon-file-moved, .octicon-file-added, .octicon-file-removed classes
  2. Even if we select the right icon, we still have to remove display: none from element's styles

You think it's their logic that should be changed instead?

@fregante

fregante commented May 2, 2026

Copy link
Copy Markdown
Member

You think it's their logic that should be changed instead?

Yes. Unless we broke something, there are many extensions that are compatible because they follow those two rules. We have a few issues regarding them and in general I sent PRs to address the bug. I even have one of the extensions installed in my testing chrome instance. "Catpuccin for Chrome"

fileInFileTree,
)?.cloneNode(true);
if (icon) {
icon.style.display = '';

@fregante fregante May 2, 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.

This fix is extension-specific, isn't it? We can't add this stuff here

Even if we select the right icon, we still have to remove display: none from element's styles

That's something wrong they're doing. They should just replace the element, not leave it behind

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.

That's something wrong they're doing. They should just replace the element, not leave it behind

Then we would still end up with this, but without the possibility for us to adapt:

image

@fregante fregante May 3, 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.

Ew I saw the feature name but was still thinking of quick-file-edit, I didn't realize they were replacing random icons with file-type icons 🤦‍♂️

Let's see if it can be fixed in there first.

], fileInList)
?.cloneNode(true);
const icon = $optional(
'svg' + is(

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.

As I said before, only DRY if it makes sense. Repeating "svg" in the 3 selectors is much more straightforward. I don’t think this saves any characters whatsoever

@fregante fregante closed this May 2, 2026
@fregante

fregante commented May 2, 2026

Copy link
Copy Markdown
Member

Closing for the aforementioned reasons. Refined GitHub is compatible, that extension is not. We cannot make adjustments for individual extensions.

@fregante
fregante deleted the quick-edit-icons branch May 2, 2026 19:01
@SunsetTechuila

SunsetTechuila commented May 2, 2026 •

Copy link
Copy Markdown
Contributor Author

For me, both our code and theirs make sense and don't need corrections. It's just a question of who will adapt to whom. I hope the Material Icons maintainer will be less categorical

@fregante

Copy link
Copy Markdown
Member

Rehashed in #9493

The selector change threw me off when reviewing this PR and I'm still not sure what was broken in GitHub File Icons since the selector change actually eventually did break it.

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants