Frontend: Alt text indicators
This commit is contained in:
parent
36c3507d84
commit
b4e01fee63
|
@ -1,5 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<button ref="thumbnail" class="zdjebgpv">
|
<button
|
||||||
|
ref="thumbnail"
|
||||||
|
class="zdjebgpv"
|
||||||
|
:class="{ 'no-alt': !file.comment }"
|
||||||
|
>
|
||||||
<ImgWithBlurhash
|
<ImgWithBlurhash
|
||||||
v-if="isThumbnailAvailable"
|
v-if="isThumbnailAvailable"
|
||||||
:hash="file.blurhash"
|
:hash="file.blurhash"
|
||||||
|
@ -92,6 +96,10 @@ const isThumbnailAvailable = computed(() => {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.no-alt {
|
||||||
|
border: 2px solid orangered;
|
||||||
|
}
|
||||||
|
|
||||||
> .icon-sub {
|
> .icon-sub {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 30%;
|
width: 30%;
|
||||||
|
|
|
@ -27,19 +27,38 @@
|
||||||
/>
|
/>
|
||||||
<div v-if="image.type === 'image/gif'" class="gif">GIF</div>
|
<div v-if="image.type === 'image/gif'" class="gif">GIF</div>
|
||||||
</a>
|
</a>
|
||||||
<button
|
<div class="_image_controls">
|
||||||
v-tooltip="i18n.ts.hide"
|
<button
|
||||||
class="_button hide"
|
v-if="!image.comment"
|
||||||
@click="hide = true"
|
v-tooltip="i18n.ts.noAltText"
|
||||||
>
|
class="_button _image_control_btn _image_control_warn"
|
||||||
<i class="ph-eye-slash ph-bold ph-lg"></i>
|
@click="noAltTextPopup"
|
||||||
</button>
|
>
|
||||||
|
<i class="ph-file-x ph-bold ph-lg"></i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-if="image.comment"
|
||||||
|
v-tooltip="i18n.ts.altText"
|
||||||
|
class="_button _image_control_btn"
|
||||||
|
@click="altTextPopup"
|
||||||
|
>
|
||||||
|
<i class="ph-file-text ph-bold ph-lg"></i>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
v-tooltip="i18n.ts.hide"
|
||||||
|
class="_button _image_control_btn"
|
||||||
|
@click="hide = true"
|
||||||
|
>
|
||||||
|
<i class="ph-eye-slash ph-bold ph-lg"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch } from "vue";
|
import { watch } from "vue";
|
||||||
import type * as misskey from "calckey-js";
|
import type * as misskey from "calckey-js";
|
||||||
|
import * as os from "@/os";
|
||||||
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
|
import { getStaticImageUrl } from "@/scripts/get-static-image-url";
|
||||||
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
|
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
|
||||||
import { defaultStore } from "@/store";
|
import { defaultStore } from "@/store";
|
||||||
|
@ -52,6 +71,26 @@ const props = defineProps<{
|
||||||
|
|
||||||
let hide = $ref(true);
|
let hide = $ref(true);
|
||||||
|
|
||||||
|
function noAltTextPopup(event: MouseEvent) {
|
||||||
|
os.alert({
|
||||||
|
type: "warning",
|
||||||
|
title: i18n.ts.noAltText,
|
||||||
|
text: i18n.ts.noAltTextDescription,
|
||||||
|
});
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
function altTextPopup(event: MouseEvent) {
|
||||||
|
os.alert({
|
||||||
|
type: "info",
|
||||||
|
title: i18n.ts.altText,
|
||||||
|
text: props.image.comment,
|
||||||
|
});
|
||||||
|
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
const url =
|
const url =
|
||||||
props.raw || defaultStore.state.loadRawImages
|
props.raw || defaultStore.state.loadRawImages
|
||||||
? props.image.url
|
? props.image.url
|
||||||
|
@ -110,22 +149,34 @@ watch(
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
|
|
||||||
> .hide {
|
> ._image_controls {
|
||||||
display: block;
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
border-radius: 6px;
|
gap: 6px;
|
||||||
background-color: var(--accentedBg);
|
|
||||||
-webkit-backdrop-filter: var(--blur, blur(15px));
|
|
||||||
backdrop-filter: var(--blur, blur(15px));
|
|
||||||
color: var(--accent);
|
|
||||||
font-size: 0.8em;
|
|
||||||
padding: 6px 8px;
|
|
||||||
text-align: center;
|
|
||||||
top: 12px;
|
top: 12px;
|
||||||
right: 12px;
|
right: 12px;
|
||||||
|
|
||||||
> i {
|
> ._image_control_btn {
|
||||||
display: block;
|
display: block;
|
||||||
|
border-radius: 6px;
|
||||||
|
background-color: var(--accentedBg);
|
||||||
|
-webkit-backdrop-filter: var(--blur, blur(15px));
|
||||||
|
backdrop-filter: var(--blur, blur(15px));
|
||||||
|
color: var(--accent);
|
||||||
|
font-size: 0.8em;
|
||||||
|
padding: 6px 8px;
|
||||||
|
text-align: center;
|
||||||
|
border: 2px solid transparent;
|
||||||
|
|
||||||
|
> i {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> ._image_control_warn {
|
||||||
|
color: #f6b195;
|
||||||
|
border: 2px solid #fa895c;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,11 +145,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, defineComponent, inject, watch } from "vue";
|
import { computed, watch } from "vue";
|
||||||
import MkButton from "@/components/MkButton.vue";
|
import MkButton from "@/components/MkButton.vue";
|
||||||
import * as os from "@/os";
|
import * as os from "@/os";
|
||||||
import MkContainer from "@/components/MkContainer.vue";
|
import MkContainer from "@/components/MkContainer.vue";
|
||||||
import ImgWithBlurhash from "@/components/MkImgWithBlurhash.vue";
|
|
||||||
import MkPagination from "@/components/MkPagination.vue";
|
import MkPagination from "@/components/MkPagination.vue";
|
||||||
import MkGalleryPostPreview from "@/components/MkGalleryPostPreview.vue";
|
import MkGalleryPostPreview from "@/components/MkGalleryPostPreview.vue";
|
||||||
import MkFollowButton from "@/components/MkFollowButton.vue";
|
import MkFollowButton from "@/components/MkFollowButton.vue";
|
||||||
|
|
|
@ -599,6 +599,8 @@ troubleshooting: "Poradce při potížích"
|
||||||
whatIsNew: "Zobrazit změny"
|
whatIsNew: "Zobrazit změny"
|
||||||
translate: "Přeložit"
|
translate: "Přeložit"
|
||||||
hide: "Skrýt"
|
hide: "Skrýt"
|
||||||
|
noAltText: "Chybějící popis obrázku"
|
||||||
|
noAltTextDescription: "Tento obrázek nemá alt text. Popis obrázku je užitečný pro zrakově-postižené uživatele a poskytuje lepší kontext pro všechny."
|
||||||
smartphone: "Telefon"
|
smartphone: "Telefon"
|
||||||
tablet: "Tablet"
|
tablet: "Tablet"
|
||||||
auto: "Auto"
|
auto: "Auto"
|
||||||
|
|
|
@ -942,6 +942,9 @@ deleteAccountConfirm: "This will irreversibly delete your account. Proceed?"
|
||||||
incorrectPassword: "Incorrect password."
|
incorrectPassword: "Incorrect password."
|
||||||
voteConfirm: "Confirm your vote for \"{choice}\"?"
|
voteConfirm: "Confirm your vote for \"{choice}\"?"
|
||||||
hide: "Hide"
|
hide: "Hide"
|
||||||
|
altText: "Alt text"
|
||||||
|
noAltText: "No alt text"
|
||||||
|
noAltTextDescription: "This image does not have alt text. Alt text is useful for vision impaired users, as well as for everyone else for context."
|
||||||
leaveGroup: "Leave group"
|
leaveGroup: "Leave group"
|
||||||
leaveGroupConfirm: "Are you sure you want to leave \"{name}\"?"
|
leaveGroupConfirm: "Are you sure you want to leave \"{name}\"?"
|
||||||
useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile"
|
useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile"
|
||||||
|
|
Loading…
Reference in New Issue