feat(dashboard): improve alt text for icons
This commit is contained in:
parent
7fa42676ef
commit
379bb7c55d
@ -3,6 +3,7 @@
|
||||
import default_avatar from '../assets/default_avatar.png';
|
||||
import { toHTML } from 'discord-markdown';
|
||||
import twemoji from 'twemoji';
|
||||
import type { Group, Member, System } from '../api/types';
|
||||
|
||||
export let item: any;
|
||||
|
||||
@ -22,6 +23,11 @@
|
||||
let avatarOpen = false;
|
||||
const toggleAvatarModal = () => (avatarOpen = !avatarOpen);
|
||||
|
||||
let altText = "icon";
|
||||
if (item.icon) altText = "group icon";
|
||||
else if (item.proxy_tags) altText = "member avatar";
|
||||
else if (item.tag) altText = "system avatar";
|
||||
|
||||
export let loading: boolean = false;
|
||||
</script>
|
||||
|
||||
@ -37,9 +43,9 @@
|
||||
<div class="d-inline-block mr-5" style="vertical-align: middle;"><Spinner color="primary" /></div>
|
||||
{/if}
|
||||
{#if item && (item.avatar_url || item.icon)}
|
||||
<img tabindex={0} on:keyup={(event) => {if (event.key === "Enter") avatarOpen = true}} on:click={toggleAvatarModal} class="rounded-circle avatar" src={icon_url} alt="Icon" />
|
||||
<img tabindex={0} on:keyup={(event) => {if (event.key === "Enter") avatarOpen = true}} on:click={toggleAvatarModal} class="rounded-circle avatar" src={icon_url} alt={altText} />
|
||||
{:else}
|
||||
<img class="rounded-circle avatar" src={default_avatar} alt="avatar (default)" />
|
||||
<img class="rounded-circle avatar" src={default_avatar} alt="icon (default)" />
|
||||
{/if}
|
||||
</div>
|
||||
<Modal isOpen={avatarOpen} toggle={toggleAvatarModal}>
|
||||
|
Loading…
Reference in New Issue
Block a user