Repository navigation
Restore tags-dropdown link to open tag pages - #2659
Conversation
This reverts commit 496dec8.
|
This feature used to be handled by |
Sorry, but I didn't get this. It is being handled by |
|
I mean the |
|
I believe, we still need this |
|
If the event bubbles, we don't have to listen to it specifically on I think with |
|
Got that. The A relevant question, Is there any disadvantage of listening it specifically on |
That's irrelevant, my suggestion was to drop code that was no longer necessary (i.e. listening to the
If that's the case, Something like: function init(): void {
if (select.exists('.blankslate')) {
return false;
}
select('.subnav')!.append(
// ...
);
// https://github.com/github/remote-input-element#events
// Wait until the network request is finished and HTML body is updated
select('.rgh-tags-dropdown')!.addEventListener('remote-input-success', onRemoteInput);
}
function onFragmentLoaded(): void {
// Change the tab to "Tags"
select('.rgh-tags-dropdown .select-menu-tab:last-child button')!.click();
}
function onRemoteInput(): void {
// Change links, which point to the content of each tag, to open the tag page instead
for (const anchorElement of select.all<HTMLAnchorElement>('.rgh-tags-dropdown .select-menu-list:last-child [href*="/tree/"]')) {
const pathnameParts = anchorElement.pathname.split('/');
pathnameParts[3] = 'releases/tag'; // Replace `tree`
anchorElement.pathname = pathnameParts.join('/');
}
} |
|
The two handlers could also be renamed to what they actually do since they don't actually handle the event; e.g. |
5524279 to
4beea48
Compare
tags-dropdown link to open tag pages
|
Thanks Hardik 🌶 |
| // https://github.com/github/remote-input-element#events | ||
| // Wait until the network request is finished and HTML body is updated | ||
| // "remote-input-success" event is bubbled | ||
| select('.rgh-tags-dropdown')!.addEventListener('remote-input-success', updateLinksToTag); |
There was a problem hiding this comment.
Support for on-remote-input-success JSX attributes has been added, in case you want to move this.
Closes #2658
Test