forked from MapComplete/MapComplete
A11y: add labels to previously unlabeled buttons, fix order
This commit is contained in:
parent
736ab13ceb
commit
fdde0aaeb3
21 changed files with 287 additions and 86 deletions
12
src/UI/Base/Link.svelte
Normal file
12
src/UI/Base/Link.svelte
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<script lang="ts">
|
||||
export let text : string
|
||||
export let href : string
|
||||
export let classnames : string = undefined
|
||||
export let download : string = undefined
|
||||
export let ariaLabel : string = undefined
|
||||
|
||||
export let newTab: boolean = false
|
||||
</script>
|
||||
|
||||
<a {href} aria-label={ariaLabel} target={newTab ? "_blank" : undefined} {download} class={classnames}>
|
||||
{@html text}</a>
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
import Translations from "../i18n/Translations"
|
||||
import BaseUIElement from "../BaseUIElement"
|
||||
import { Store } from "../../Logic/UIEventSource"
|
||||
import { Utils } from "../../Utils"
|
||||
|
||||
export default class Link extends BaseUIElement {
|
||||
private readonly _href: string | Store<string>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte"
|
||||
import { twJoin } from "tailwind-merge"
|
||||
import { Translation } from "../i18n/Translation"
|
||||
import { ariaLabel } from "../../Utils/ariaLabel"
|
||||
|
||||
/**
|
||||
* A round button with an icon and possible a small text, which hovers above the map
|
||||
*/
|
||||
const dispatch = createEventDispatcher()
|
||||
export let cls = ""
|
||||
export let arialabel: Translation = undefined
|
||||
</script>
|
||||
|
||||
<button
|
||||
on:click={(e) => dispatch("click", e)}
|
||||
on:keydown
|
||||
use:ariaLabel={arialabel}
|
||||
class={twJoin("pointer-events-auto m-0.5 h-fit w-fit rounded-full p-0.5 sm:p-1 md:m-1", cls)}
|
||||
>
|
||||
<slot />
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
import ToSvelte from "./ToSvelte.svelte"
|
||||
import Svg from "../../Svg"
|
||||
import Share from "../../assets/svg/Share.svelte"
|
||||
import { ariaLabel } from "../../Utils/ariaLabel"
|
||||
import Translations from "../i18n/Translations"
|
||||
|
||||
export let generateShareData: () => {
|
||||
text: string
|
||||
|
|
@ -24,7 +26,7 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<button on:click={share} class="secondary m-0 h-8 w-8 p-0">
|
||||
<button on:click={share} class="secondary m-0 h-8 w-8 p-0" use:ariaLabel={Translations.t.general.share}>
|
||||
<slot name="content">
|
||||
<Share class="h-7 w-7 p-1" />
|
||||
</slot>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue