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

Issue4299 #4434

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<div v-for="stamp in stampList" :key="stamp.id" :class="$style.stamp">
<stamp-element
:stamp="stamp"
:is-detail-shown="isDetailShown"
@add-stamp="addStamp"
@remove-stamp="removeStamp"
/>
Expand Down Expand Up @@ -136,7 +137,7 @@ const { toggleStampPicker } = useStampPickerInvoker(
&[data-show-details] {
flex-direction: column;
}
contain: content;
contain: none;
}
.stamp {
margin: {
Expand Down
27 changes: 27 additions & 0 deletions src/components/Main/MainView/MessageElement/StampElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:title="tooltip"
Copy link
Contributor

Choose a reason for hiding this comment

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

image

今の状態だと、↑の画像みたいにマウスホバー時のポップアップが 2 つ同時に出てしまうので title 属性を消していいと思います
ただ、これをしてしまうと a11y (アクセシビリティ) の観点から困ったことになる可能性もあるので、 aria-label などの属性に切り替えるのを検討したほうがいいと思います

Suggested change
:title="tooltip"
<!-- :title="tooltip" ここを消す -->

Copy link
Author

Choose a reason for hiding this comment

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

title属性を消去してaria-label属性に切り替えました
Discordを参考にしてaria-labelの内容を定めたのでa11yの観点からも問題はないと思われます

:data-include-me="$boolAttr(includeMe)"
@click="onClick"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
>
<transition name="stamp-pressed" mode="out-in">
<a-stamp
Expand All @@ -15,6 +17,11 @@
</transition>
<spin-number :value="stamp.sum" :class="$style.count" />
</div>
<stamp-scaled-element
:class="$style.scaleReaction"
:show="isHovered && !isDetailShown"
:stamp="stamp"
/>
</template>

<script lang="ts" setup>
Expand All @@ -24,9 +31,12 @@ import { ref, computed, watch, onMounted } from 'vue'
import { useStampsStore } from '/@/store/entities/stamps'
import { useUsersStore } from '/@/store/entities/users'
import type { MessageStampById } from '/@/lib/messageStampList'
import StampScaledElement from './StampScaledElement.vue'
import useHover from '/@/composables/dom/useHover'

const props = defineProps<{
stamp: MessageStampById
isDetailShown: boolean
}>()

const emit = defineEmits<{
Expand Down Expand Up @@ -85,6 +95,8 @@ watch(
isProgress.value = false
}
)

const { isHovered, onMouseEnter, onMouseLeave } = useHover()
</script>

<style lang="scss" module>
Expand All @@ -103,6 +115,7 @@ watch(
user-select: none;
overflow: hidden;
contain: content;
position: relative;
}

.count {
Expand All @@ -118,4 +131,18 @@ watch(
right: 4px;
}
}

.scaleReaction {
@include background-tertiary;
display: flex;
height: 3.5rem;
align-items: flex-start;
padding: 0.125rem 0.25rem;
border-radius: 0.25rem;
user-select: none;
overflow: visible;
contain: content;
position: absolute;
bottom: 105%;
}
</style>
58 changes: 58 additions & 0 deletions src/components/Main/MainView/MessageElement/StampScaledElement.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<div v-show="show" :class="$style.scaleReaction">
<transition name="scale-reaction">
<!-- sizeを46より大きくすると見切れる -->
<a-stamp
:key="stamp.id"
:stamp-id="stamp.id"
:size="46"
:class="$style.stamp"
without-title
/>
</transition>
<stamp-detail-element :class="$style.detail" :stamp="stamp" />
</div>
</template>

<script lang="ts" setup>
import AStamp from '/@/components/UI/AStamp.vue'
import type { MessageStampById } from '/@/lib/messageStampList'
import StampDetailElement from './StampDetailElement.vue'

const props = defineProps<{
stamp: MessageStampById
show: boolean
}>()
</script>

<style lang="scss" module>
.scaleReaction {
@include color-ui-tertiary;
@include background-primary;
display: flex;
border-radius: 4px;
contain: none;
flex-wrap: wrap;
border: solid 2px $theme-ui-tertiary-default;
}
.stamp {
margin: {
right: 0.2rem;
bottom: 0.2rem;
}
display: flex;
}

.detail {
color: var(--specific-count-text);
@include color-ui-primary;
max-width: 500px;
min-width: 0;
overflow: hidden;
overflow: clip;
margin: {
left: 6px;
right: 4px;
}
}
</style>
Loading