fea1fc288b
If I've understood things correctly, this should allow regular users to skip over the badge elements with Tab, while still allowing screen reader apps to read/focus the badge elements. https://github.com/ankitects/anki/pull/2721#issuecomment-1761740985 https://forums.ankiweb.net/t/anki-23-10-beta-5/35677/18
60 lines
1.2 KiB
Svelte
60 lines
1.2 KiB
Svelte
<!--
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
-->
|
|
<script lang="ts">
|
|
import { createEventDispatcher, onMount } from "svelte";
|
|
|
|
import IconConstrain from "./IconConstrain.svelte";
|
|
|
|
let className = "";
|
|
export { className as class };
|
|
export let tooltip: string | undefined = undefined;
|
|
|
|
export let iconSize = 100;
|
|
export let widthMultiplier = 1;
|
|
export let flipX = false;
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
let spanRef: HTMLSpanElement;
|
|
|
|
onMount(() => {
|
|
dispatch("mount", { span: spanRef });
|
|
});
|
|
</script>
|
|
|
|
<button
|
|
bind:this={spanRef}
|
|
title={tooltip}
|
|
class="badge {className}"
|
|
on:click
|
|
on:mouseenter
|
|
on:mouseleave
|
|
tabindex="-1"
|
|
>
|
|
<IconConstrain {iconSize} {widthMultiplier} {flipX}>
|
|
<slot />
|
|
</IconConstrain>
|
|
</button>
|
|
|
|
<style>
|
|
.badge {
|
|
color: var(--badge-color, inherit);
|
|
border: none;
|
|
background: transparent;
|
|
padding: 0;
|
|
}
|
|
|
|
.badge:hover,
|
|
.badge:active {
|
|
border: none;
|
|
background: transparent;
|
|
box-shadow: none;
|
|
}
|
|
|
|
.dropdown-toggle::after {
|
|
display: none;
|
|
}
|
|
</style>
|