Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add releases-dropdown feature #6506

Merged
merged 10 commits into from Apr 15, 2023
Merged

Add releases-dropdown feature #6506

merged 10 commits into from Apr 15, 2023

Conversation

fregante
Copy link
Member

@fregante fregante commented Apr 13, 2023

Follows:

Super easy, barely an inconvenience. The only issue is that it's technically misusing the datalist for navigation (just like mobile websites have done with select from 2007 until recently)

Test URLs

https://github.com/refined-github/refined-github/releases

Screenshot

Screenshot

@fregante fregante marked this pull request as draft April 13, 2023 06:15
@fregante
Copy link
Member Author

Ready. Readme screenshot:

Screenshot 4

Screen.Recording.mov

@fregante fregante marked this pull request as ready for review April 13, 2023 06:58

void features.add(import.meta.url, {
include: [
pageDetect.isReleasesOrTags,
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@kidonng kidonng Apr 14, 2023

Choose a reason for hiding this comment

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

Then this should use isReleases? Because the search box only exists there

Also previous tags-dropdown works on tags page, should this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Then this should use isReleases? Because the search box only exists there

Done

Also previous tags-dropdown works on tags page, should this one?

The issue is that the native field SEARCHES the releases notes, which means it does nothing on tags. See https://github.com/python/cpython/releases?q=v3&expanded=true which is empty even if there are plenty "v3" tags

So if we were to add this feature there, we'd have to reinvent the feature to not use datalist. Not worth it in this PR (or maybe ever)

{latestTags.reverse().map(tag => <option value={tag}/>)}
</datalist>,
);
searchField.setAttribute('list', 'rgh-tags-dropdown');
Copy link
Member Author

Choose a reason for hiding this comment

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

Unreal… searchField.list is read-only 🤷‍♂️

const field = event.delegateTarget;
const selectedTag = field.value;
if (!('inputType' in event) && latestTags!.includes(selectedTag)) {
location.href = buildRepoURL('releases/tag', selectedTag);
Copy link
Member Author

Choose a reason for hiding this comment

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

As expected, it's broken on unescaped tag names:

https://github.com/refined-github/refined-github/releases

Screenshot 5

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed! Pretty sure we have the same bug in features like tags-on-commits-list too

@kidonng
Copy link
Member

kidonng commented Apr 14, 2023

The search icon and dropdown arrow is unaligned. Can't unsee. Let's add these CSS:

/* This can go into github-bugs */
.subnav-search-icon {
    top: 8px;
}

#release-filter::-webkit-calendar-picker-indicator {
    position: relative;
    top: -2px;
}

image

@fregante
Copy link
Member Author

fregante commented Apr 14, 2023

Added both to GitHub-bugs. Let's always include test URLs there because it's hard to keep those micro-bugfixes up to date.

Screenshot 5

@fregante fregante changed the title Add tags-dropdown feature Add releases-dropdown feature Apr 14, 2023
@fregante fregante enabled auto-merge (squash) April 15, 2023 08:17
@fregante fregante merged commit 3eeda08 into main Apr 15, 2023
9 checks passed
@fregante fregante deleted the tags-dropdown-2 branch April 15, 2023 08:20
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.

None yet

2 participants