-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix console error in quick-label-removal
#4939
Conversation
Co-authored-by: Federico Brigante <[email protected]>
Honestly I don't think this code is needed anymore. After doing some testing without it, it seems GitHub does update the labels dropdown correctly on its own (although it can take a second). Maybe keep it for GHE? |
Let's drop it if that's the case.
Not a fundamental feature, so we can drop it |
const menu = deferredContentWrapper.closest('[src]')!; | ||
deferredContentWrapper.textContent = ''; | ||
deferredContentWrapper.append(<include-fragment src={menu.getAttribute('src')!}/>); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is still beneficial.
In #4953 I removed a label and then opened the menu to add one. The label was still selected in there and it added the label again.
Maybe a "simpler" or safer alternative would be to look for the specific label in the dropdown and disable it there as well, to avoid this specific issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that bug too.
The fix is tricky, because immediately replacing the dropdown content with an include fragment doesn't always work, especially when removing several labels in quick succession and then opening the dropdown right away.
Maybe we should add a listener on the dropdown button? The logic would be:
- When a label is removed, mark the dropdown as "outdated" but don't actually force it to update
- Listen to the opening of the dropdown. If it's outdated and GitHub hasn't already updated its contents (i.e. no include fragments is already there), replace them with an
<include-fragment>
.
Maybe a "simpler" or safer alternative would be to look for the specific label in the dropdown and disable it there as well, to avoid this specific issue
Changing the aria-selected
attribute of a label in the dropdown has zero effect, it's purely cosmetic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember how it works, but doesn't GitHub already use a "data-url" attribute that is then loaded as a fragment when the user clicks it? If it is, then we just need to set it again and empty the dropdown. GitHub will then take care of loading it as usual.
I don't want something super complicated though 😬 I think this would be good if it works
Fixes #4934
Test URLs
refined-github/sandbox#3
Screenshot
n/a