From ed23f51838477dc04fb5daedb6bf1bdf96f2ca65 Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 22 May 2023 22:02:22 -0400
Subject: Make reaction button accessible

---
 src/components/emoji_reactions/emoji_reactions.vue | 104 +++++++++++++++++++--
 1 file changed, 96 insertions(+), 8 deletions(-)

(limited to 'src/components/emoji_reactions/emoji_reactions.vue')

diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index eb46018e..3171785b 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -1,15 +1,14 @@
 <template>
   <div class="EmojiReactions">
-    <UserListPopover
+    <span
       v-for="(reaction) in emojiReactions"
       :key="reaction.url || reaction.name"
-      :users="accountsForEmoji[reaction.name]"
+      class="emoji-reaction-container btn-group"
     >
       <button
         class="emoji-reaction btn button-default"
         :class="{ '-picked-reaction': reactedWith(reaction.name), 'not-clickable': !loggedIn }"
         @click="emojiOnClick(reaction.name, $event)"
-        @mouseenter="fetchEmojiReactionsByIfMissing()"
       >
         <span
           class="reaction-emoji"
@@ -26,9 +25,36 @@
             class="reaction-emoji reaction-emoji-content"
           >{{ reaction.name }}</span>
         </span>
-        <span>{{ reaction.count }}</span>
+        <FALayers>
+        <FAIcon
+          v-if="reactedWith(reaction.name)"
+          class="active-marker"
+          transform="shrink-6 up-9"
+          icon="check"
+        />
+        <FAIcon
+          v-if="!reactedWith(reaction.name)"
+          class="focus-marker"
+          transform="shrink-6 up-9"
+          icon="plus"
+        />
+        <FAIcon
+          v-else
+          class="focus-marker"
+          transform="shrink-6 up-9"
+          icon="minus"
+        />
+        </FALayers>
       </button>
+    <UserListPopover
+      :users="accountsForEmoji[reaction.name]"
+      class="emoji-reaction-popover"
+      @show="fetchEmojiReactionsByIfMissing()"
+      :trigger-attrs="{ class: ['btn', 'button-default', 'emoji-reaction-count-button', { '-picked-reaction': reactedWith(reaction.name) }] }"
+    >
+      <span class="emoji-reaction-counts">{{ reaction.count }}</span>
     </UserListPopover>
+    </span>
     <a
       v-if="tooManyReactions"
       class="emoji-reaction-expand faint"
@@ -43,6 +69,7 @@
 <script src="./emoji_reactions.js"></script>
 <style lang="scss">
 @import "../../variables";
+@import "../../mixins";
 
 .EmojiReactions {
   display: flex;
@@ -51,10 +78,36 @@
 
   --emoji-size: calc(1.25em * var(--emojiReactionsScale, 1));
 
-  .emoji-reaction {
-    padding: 0 0.5em;
-    margin-right: 0.5em;
+  .emoji-reaction-container {
+    display: flex;
+    align-items: stretch;
     margin-top: 0.5em;
+    margin-right: 0.5em;
+
+    .emoji-reaction-popover {
+      padding: 0;
+
+      .emoji-reaction-count-button {
+        background-color: var(--btn);
+        height: 100%;
+        border-top-left-radius: 0;
+        border-bottom-left-radius: 0;
+        box-sizing: border-box;
+        min-width: 2em;
+        display: inline-flex;
+        justify-content: center;
+        align-items: center;
+
+        &.-picked-reaction {
+          border: 1px solid var(--accent, $fallback--link);
+          margin-right: -1px;
+        }
+      }
+    }
+  }
+
+  .emoji-reaction {
+    padding-left: 0.5em;
     display: flex;
     align-items: center;
     justify-content: center;
@@ -97,7 +150,42 @@
     &.-picked-reaction {
       border: 1px solid var(--accent, $fallback--link);
       margin-left: -1px; // offset the border, can't use inset shadows either
-      margin-right: calc(0.5em - 1px);
+      margin-right: -1px;
+
+      .svg-inline--fa {
+        color: $fallback--link;
+        color: var(--accent, $fallback--link);
+      }
+    }
+
+    @include unfocused-style {
+      .svg-inline--fa {
+        color: $fallback--text;
+        color: var(--btnText, $fallback--text);
+      }
+
+      .focus-marker {
+        visibility: hidden;
+      }
+
+      .active-marker {
+        visibility: visible;
+      }
+    }
+
+    @include focused-style {
+      .svg-inline--fa {
+        color: $fallback--link;
+        color: var(--accent, $fallback--link);
+      }
+
+      .focus-marker {
+        visibility: visible;
+      }
+
+      .active-marker {
+        visibility: hidden;
+      }
     }
   }
 
-- 
cgit v1.2.3-70-g09d2


From 8a1074336c3cce8111a23281bbe71301b93c3420 Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 22 May 2023 22:09:04 -0400
Subject: Make emoji reactions clickable when not logged in

---
 src/components/emoji_reactions/emoji_reactions.js  |  3 +++
 src/components/emoji_reactions/emoji_reactions.vue | 20 ++++++++------------
 2 files changed, 11 insertions(+), 12 deletions(-)

(limited to 'src/components/emoji_reactions/emoji_reactions.vue')

diff --git a/src/components/emoji_reactions/emoji_reactions.js b/src/components/emoji_reactions/emoji_reactions.js
index b3520a55..74cb844c 100644
--- a/src/components/emoji_reactions/emoji_reactions.js
+++ b/src/components/emoji_reactions/emoji_reactions.js
@@ -45,6 +45,9 @@ const EmojiReactions = {
     },
     loggedIn () {
       return !!this.$store.state.users.currentUser
+    },
+    remoteInteractionLink () {
+      return this.$store.getters.remoteInteractionLink({ statusId: this.status.id })
     }
   },
   methods: {
diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index 3171785b..f30afcb2 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -5,9 +5,12 @@
       :key="reaction.url || reaction.name"
       class="emoji-reaction-container btn-group"
     >
-      <button
+      <component
+        :is="loggedIn ? 'button' : 'a'"
+        v-bind="!loggedIn ? { href: remoteInteractionLink } : {}"
+        role="button"
         class="emoji-reaction btn button-default"
-        :class="{ '-picked-reaction': reactedWith(reaction.name), 'not-clickable': !loggedIn }"
+        :class="{ '-picked-reaction': reactedWith(reaction.name) }"
         @click="emojiOnClick(reaction.name, $event)"
       >
         <span
@@ -45,7 +48,7 @@
           icon="minus"
         />
         </FALayers>
-      </button>
+      </component>
     <UserListPopover
       :users="accountsForEmoji[reaction.name]"
       class="emoji-reaction-popover"
@@ -112,6 +115,8 @@
     align-items: center;
     justify-content: center;
     box-sizing: border-box;
+    border-top-right-radius: 0;
+    border-bottom-right-radius: 0;
 
     .reaction-emoji {
       width: var(--emoji-size);
@@ -138,15 +143,6 @@
       outline: none;
     }
 
-    &.not-clickable {
-      cursor: default;
-
-      &:hover {
-        box-shadow: $fallback--buttonShadow;
-        box-shadow: var(--buttonShadow);
-      }
-    }
-
     &.-picked-reaction {
       border: 1px solid var(--accent, $fallback--link);
       margin-left: -1px; // offset the border, can't use inset shadows either
-- 
cgit v1.2.3-70-g09d2


From 0b2f676e50c5fb8da1d5e673ee6a2723ee7c9e1e Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 22 May 2023 22:14:44 -0400
Subject: Fix focus (unvisible) style

---
 src/components/emoji_reactions/emoji_reactions.vue | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/components/emoji_reactions/emoji_reactions.vue')

diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index f30afcb2..3f76cdc6 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -143,6 +143,11 @@
       outline: none;
     }
 
+    .svg-inline--fa {
+      color: $fallback--text;
+      color: var(--btnText, $fallback--text);
+    }
+
     &.-picked-reaction {
       border: 1px solid var(--accent, $fallback--link);
       margin-left: -1px; // offset the border, can't use inset shadows either
@@ -155,11 +160,6 @@
     }
 
     @include unfocused-style {
-      .svg-inline--fa {
-        color: $fallback--text;
-        color: var(--btnText, $fallback--text);
-      }
-
       .focus-marker {
         visibility: hidden;
       }
-- 
cgit v1.2.3-70-g09d2


From 48ee11fea35123090762d98f5249168679f05e3a Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 22 May 2023 22:18:42 -0400
Subject: Add aria for react button

---
 src/components/emoji_reactions/emoji_reactions.vue | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/components/emoji_reactions/emoji_reactions.vue')

diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index 3f76cdc6..1fdfb87b 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -11,6 +11,8 @@
         role="button"
         class="emoji-reaction btn button-default"
         :class="{ '-picked-reaction': reactedWith(reaction.name) }"
+        :title="reaction.url ? reaction.name : undefined"
+        :aria-pressed="reactedWith(reaction.name)"
         @click="emojiOnClick(reaction.name, $event)"
       >
         <span
@@ -19,7 +21,6 @@
           <img
             v-if="reaction.url"
             :src="reaction.url"
-            :title="reaction.name"
             class="reaction-emoji-content"
             width="1em"
           >
-- 
cgit v1.2.3-70-g09d2


From d3e251665f50c7d289066b0be0fdfa5b227c3b65 Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 22 May 2023 22:20:09 -0400
Subject: Lint

---
 src/components/emoji_reactions/emoji_reactions.vue | 52 +++++++++++-----------
 1 file changed, 26 insertions(+), 26 deletions(-)

(limited to 'src/components/emoji_reactions/emoji_reactions.vue')

diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index 1fdfb87b..d475d5dc 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -30,34 +30,34 @@
           >{{ reaction.name }}</span>
         </span>
         <FALayers>
-        <FAIcon
-          v-if="reactedWith(reaction.name)"
-          class="active-marker"
-          transform="shrink-6 up-9"
-          icon="check"
-        />
-        <FAIcon
-          v-if="!reactedWith(reaction.name)"
-          class="focus-marker"
-          transform="shrink-6 up-9"
-          icon="plus"
-        />
-        <FAIcon
-          v-else
-          class="focus-marker"
-          transform="shrink-6 up-9"
-          icon="minus"
-        />
+          <FAIcon
+            v-if="reactedWith(reaction.name)"
+            class="active-marker"
+            transform="shrink-6 up-9"
+            icon="check"
+          />
+          <FAIcon
+            v-if="!reactedWith(reaction.name)"
+            class="focus-marker"
+            transform="shrink-6 up-9"
+            icon="plus"
+          />
+          <FAIcon
+            v-else
+            class="focus-marker"
+            transform="shrink-6 up-9"
+            icon="minus"
+          />
         </FALayers>
       </component>
-    <UserListPopover
-      :users="accountsForEmoji[reaction.name]"
-      class="emoji-reaction-popover"
-      @show="fetchEmojiReactionsByIfMissing()"
-      :trigger-attrs="{ class: ['btn', 'button-default', 'emoji-reaction-count-button', { '-picked-reaction': reactedWith(reaction.name) }] }"
-    >
-      <span class="emoji-reaction-counts">{{ reaction.count }}</span>
-    </UserListPopover>
+      <UserListPopover
+        :users="accountsForEmoji[reaction.name]"
+        class="emoji-reaction-popover"
+        :trigger-attrs="{ class: ['btn', 'button-default', 'emoji-reaction-count-button', { '-picked-reaction': reactedWith(reaction.name) }] }"
+        @show="fetchEmojiReactionsByIfMissing()"
+      >
+        <span class="emoji-reaction-counts">{{ reaction.count }}</span>
+      </UserListPopover>
     </span>
     <a
       v-if="tooManyReactions"
-- 
cgit v1.2.3-70-g09d2


From c67513002460f56901246c81a9e7b6dbad89be27 Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 22 May 2023 22:30:54 -0400
Subject: Make reaction counter accessible

---
 src/components/emoji_reactions/emoji_reactions.js  | 11 +++++++++++
 src/components/emoji_reactions/emoji_reactions.vue |  2 +-
 src/i18n/en.json                                   |  3 ++-
 3 files changed, 14 insertions(+), 2 deletions(-)

(limited to 'src/components/emoji_reactions/emoji_reactions.vue')

diff --git a/src/components/emoji_reactions/emoji_reactions.js b/src/components/emoji_reactions/emoji_reactions.js
index 74cb844c..b4936424 100644
--- a/src/components/emoji_reactions/emoji_reactions.js
+++ b/src/components/emoji_reactions/emoji_reactions.js
@@ -77,6 +77,17 @@ const EmojiReactions = {
       } else {
         this.reactWith(emoji)
       }
+    },
+    counterTriggerAttrs (reaction) {
+      return {
+        class: [
+          'btn',
+          'button-default',
+          'emoji-reaction-count-button',
+          { '-picked-reaction': this.reactedWith(reaction.name) }
+        ],
+        'aria-label': this.$tc('status.reaction_count_label', reaction.count, { num: reaction.count })
+      }
     }
   }
 }
diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index d475d5dc..20a1f4a1 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -53,7 +53,7 @@
       <UserListPopover
         :users="accountsForEmoji[reaction.name]"
         class="emoji-reaction-popover"
-        :trigger-attrs="{ class: ['btn', 'button-default', 'emoji-reaction-count-button', { '-picked-reaction': reactedWith(reaction.name) }] }"
+        :trigger-attrs="counterTriggerAttrs(reaction)"
         @show="fetchEmojiReactionsByIfMissing()"
       >
         <span class="emoji-reaction-counts">{{ reaction.count }}</span>
diff --git a/src/i18n/en.json b/src/i18n/en.json
index b051f088..01309d0e 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -933,7 +933,8 @@
     "show_all_conversation_with_icon": "{icon} {text}",
     "show_all_conversation": "Show full conversation ({numStatus} other status) | Show full conversation ({numStatus} other statuses)",
     "show_only_conversation_under_this": "Only show replies to this status",
-    "status_history": "Status history"
+    "status_history": "Status history",
+    "reaction_count_label": "{num} person reacted | {num} people reacted"
   },
   "user_card": {
     "approve": "Approve",
-- 
cgit v1.2.3-70-g09d2


From b82f2a3543b733eda9ce52d60d6b7aba60f787d0 Mon Sep 17 00:00:00 2001
From: tusooa <tusooa@kazv.moe>
Date: Mon, 22 May 2023 23:09:05 -0400
Subject: Use button text in reaction counter

---
 src/components/emoji_reactions/emoji_reactions.vue | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'src/components/emoji_reactions/emoji_reactions.vue')

diff --git a/src/components/emoji_reactions/emoji_reactions.vue b/src/components/emoji_reactions/emoji_reactions.vue
index 20a1f4a1..92fc58ca 100644
--- a/src/components/emoji_reactions/emoji_reactions.vue
+++ b/src/components/emoji_reactions/emoji_reactions.vue
@@ -101,6 +101,8 @@
         display: inline-flex;
         justify-content: center;
         align-items: center;
+        color: $fallback--text;
+        color: var(--btnText, $fallback--text);
 
         &.-picked-reaction {
           border: 1px solid var(--accent, $fallback--link);
-- 
cgit v1.2.3-70-g09d2

