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>
|
||||||
|
<div class="_image_controls">
|
||||||
|
<button
|
||||||
|
v-if="!image.comment"
|
||||||
|
v-tooltip="i18n.ts.noAltText"
|
||||||
|
class="_button _image_control_btn _image_control_warn"
|
||||||
|
@click="noAltTextPopup"
|
||||||
|
>
|
||||||
|
<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
|
<button
|
||||||
v-tooltip="i18n.ts.hide"
|
v-tooltip="i18n.ts.hide"
|
||||||
class="_button hide"
|
class="_button _image_control_btn"
|
||||||
@click="hide = true"
|
@click="hide = true"
|
||||||
>
|
>
|
||||||
<i class="ph-eye-slash ph-bold ph-lg"></i>
|
<i class="ph-eye-slash ph-bold ph-lg"></i>
|
||||||
</button>
|
</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,9 +149,15 @@ watch(
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
|
|
||||||
> .hide {
|
> ._image_controls {
|
||||||
display: block;
|
display: flex;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
gap: 6px;
|
||||||
|
top: 12px;
|
||||||
|
right: 12px;
|
||||||
|
|
||||||
|
> ._image_control_btn {
|
||||||
|
display: block;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background-color: var(--accentedBg);
|
background-color: var(--accentedBg);
|
||||||
-webkit-backdrop-filter: var(--blur, blur(15px));
|
-webkit-backdrop-filter: var(--blur, blur(15px));
|
||||||
|
@ -121,14 +166,20 @@ watch(
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
padding: 6px 8px;
|
padding: 6px 8px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
top: 12px;
|
border: 2px solid transparent;
|
||||||
right: 12px;
|
|
||||||
|
|
||||||
> i {
|
> i {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
> ._image_control_warn {
|
||||||
|
color: #f6b195;
|
||||||
|
border: 2px solid #fa895c;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
> a {
|
> a {
|
||||||
display: block;
|
display: block;
|
||||||
cursor: zoom-in;
|
cursor: zoom-in;
|
||||||
|
|
|
@ -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