Skip to content

Commit 745bfae

Browse files
committed
Improve map tools
1 parent 14d0ba6 commit 745bfae

4 files changed

Lines changed: 21 additions & 13 deletions

File tree

src/lib/components/contents/details/editor/translate-button.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
{#if otherLocales.length === 1}
4040
{@const [otherLocale] = otherLocales}
4141
{@const label = $_('translate_from_x', { values: { locale: getLocaleLabel(otherLocale) } })}
42-
<!-- @todo Replace the native tooltip -->
42+
<!-- @todo Replace `title` with a native tooltip -->
4343
<Button
4444
variant="ghost"
4545
{size}

src/lib/components/contents/details/widgets/map/map-editor.svelte

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<script>
99
// cSpell:ignore Nominatim jsonv2
1010
11-
import { AlertDialog, Button, Listbox, Option, SearchBar } from '@sveltia/ui';
11+
import { AlertDialog, Button, Icon, Listbox, Option, SearchBar } from '@sveltia/ui';
1212
import { isObject } from '@sveltia/utils/object';
1313
import { onMount, untrack } from 'svelte';
1414
import { _ } from 'svelte-i18n';
@@ -361,18 +361,24 @@
361361
362362
<!-- @todo Support LineString and Polygon types -->
363363
{#if geometryType === 'Point'}
364-
<!-- @todo Replace this with <Combobox> -->
365-
<div class="toolbar">
366-
<SearchBar bind:value={searchQuery} {readonly} flex />
364+
<div role="none" class="toolbar">
365+
<!-- @todo Replace this with `<Combobox>` -->
366+
<SearchBar bind:value={searchQuery} {readonly} flex placeholder={$_('find_place')} />
367+
<!-- @todo Replace `title` with a native tooltip -->
367368
<Button
368369
variant="tertiary"
369-
label={$_('use_your_location')}
370+
iconic
371+
title={$_('use_your_location')}
372+
aria-label={$_('use_your_location')}
370373
disabled={readonly}
371374
onclick={() => {
372375
useCurrentLocation();
373376
}}
374-
/>
375-
377+
>
378+
{#snippet startIcon()}
379+
<Icon name="near_me" />
380+
{/snippet}
381+
</Button>
376382
{#if !required}
377383
<Button
378384
variant="tertiary"
@@ -386,11 +392,11 @@
386392
</div>
387393
388394
{#if searching}
389-
<div class="search-result searching">{$_('searching')}</div>
395+
<div role="alert" class="search-result searching">{$_('searching')}</div>
390396
{:else if searchQuery}
391397
{#if searchResults}
392398
{#if searchResults.length}
393-
<Listbox>
399+
<Listbox aria-label={$_('search_results')}>
394400
{#each searchResults as result (result.place_id)}
395401
<Option
396402
label={result.display_name}
@@ -401,7 +407,7 @@
401407
{/each}
402408
</Listbox>
403409
{:else}
404-
<div class="search-result no-result">{$_('no_results')}</div>
410+
<div role="alert" class="search-result no-result">{$_('no_results')}</div>
405411
{/if}
406412
{/if}
407413
{/if}

src/lib/locales/en.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,11 @@ export const strings = {
564564
empty_key: 'Key is required.',
565565
duplicate_key: 'Key must be unique.',
566566
},
567-
use_your_location: 'Use Current Location',
567+
find_place: 'Find a Place',
568+
use_your_location: 'Use Your Location',
568569
geolocation_error_title: 'Geolocation Error',
569570
geolocation_error_body: 'There was an error while retrieving your location.',
570-
geolocation_unsupported: 'Geolocation is not supported by this browser.',
571+
geolocation_unsupported: 'Geolocation API is not supported by this browser.',
571572

572573
// Content preview
573574
boolean: {

src/lib/locales/ja.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ export const strings = {
468468
description: 'エントリーを保存中に問題が発生しました。後で再度お試しください。',
469469
},
470470
},
471+
find_place: '場所を検索',
471472
use_your_location: '現在地を使用',
472473
geolocation_error_title: '位置情報エラー',
473474
geolocation_error_body: 'あなたの現在地を取得できませんでした。',

0 commit comments

Comments
 (0)