diff options
author | 2019-05-22 20:14:47 +0800 | |
---|---|---|
committer | 2019-05-22 20:14:47 +0800 | |
commit | a9134f0e91056b02fbb717f9ac49d00c7e0411dc (patch) | |
tree | a2bb0e8a7325c74c950603de7e21e7c87552e7df | |
parent | f0872c2980b9a29d78aaa98937e29fc05091ccbc (diff) | |
download | refined-github-a9134f0e91056b02fbb717f9ac49d00c7e0411dc.tar.gz refined-github-a9134f0e91056b02fbb717f9ac49d00c7e0411dc.tar.zst refined-github-a9134f0e91056b02fbb717f9ac49d00c7e0411dc.zip |
Improve clickability of reaction buttons in Firefox (#2062)19.5.22.1921
-rw-r--r-- | source/features/reactions-avatars.tsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/features/reactions-avatars.tsx b/source/features/reactions-avatars.tsx index cd3576ae..4a851cba 100644 --- a/source/features/reactions-avatars.tsx +++ b/source/features/reactions-avatars.tsx @@ -36,12 +36,17 @@ function add(): void { const participantByReaction = [...list.children as HTMLCollectionOf<HTMLElement>].map(getParticipants); const flatParticipants = flatZip(participantByReaction, avatarLimit); - for (const participant of flatParticipants) { - participant.container.append( - <a href={`/${participant.username}`}> - <img src={`/${participant.username}.png?size=${window.devicePixelRatio * 20}`}/> + for (const {container, username} of flatParticipants) { + container.append( + <a> + <img src={`/${username}.png?size=${window.devicePixelRatio * 20}`} /> </a> ); + + // Without this, Firefox will follow the link instead of submitting the reaction button + if (!navigator.userAgent.includes('Firefox/')) { + (container.lastElementChild as HTMLAnchorElement).href = `/${username}`; + } } list.classList.add('rgh-reactions'); |