forked from MapComplete/MapComplete
		
	A11y: screen navigation improvements, see #1181
This commit is contained in:
		
							parent
							
								
									66369ef0b4
								
							
						
					
					
						commit
						af4d9bb2bf
					
				
					 25 changed files with 483 additions and 325 deletions
				
			
		| 
						 | 
				
			
			@ -1,21 +1,21 @@
 | 
			
		|||
<script lang="ts">
 | 
			
		||||
    import { Store } from "../../Logic/UIEventSource"
 | 
			
		||||
    import type { OsmTags } from "../../Models/OsmFeature"
 | 
			
		||||
    import type { SpecialVisualizationState } from "../SpecialVisualization"
 | 
			
		||||
    import type { P4CPicture } from "../../Logic/Web/NearbyImagesSearch"
 | 
			
		||||
    import AllImageProviders from "../../Logic/ImageProviders/AllImageProviders"
 | 
			
		||||
    import LinkImageAction from "../../Logic/Osm/Actions/LinkImageAction"
 | 
			
		||||
    import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"
 | 
			
		||||
    import { Tag } from "../../Logic/Tags/Tag"
 | 
			
		||||
    import { GeoOperations } from "../../Logic/GeoOperations"
 | 
			
		||||
    import type { Feature } from "geojson"
 | 
			
		||||
    import Translations from "../i18n/Translations"
 | 
			
		||||
    import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
 | 
			
		||||
    import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
 | 
			
		||||
    import AttributedImage from "./AttributedImage.svelte"
 | 
			
		||||
    import SpecialTranslation from "../Popup/TagRendering/SpecialTranslation.svelte"
 | 
			
		||||
  import { UIEventSource } from "../../Logic/UIEventSource"
 | 
			
		||||
  import type { OsmTags } from "../../Models/OsmFeature"
 | 
			
		||||
  import type { SpecialVisualizationState } from "../SpecialVisualization"
 | 
			
		||||
  import type { P4CPicture } from "../../Logic/Web/NearbyImagesSearch"
 | 
			
		||||
  import AllImageProviders from "../../Logic/ImageProviders/AllImageProviders"
 | 
			
		||||
  import LinkImageAction from "../../Logic/Osm/Actions/LinkImageAction"
 | 
			
		||||
  import ChangeTagAction from "../../Logic/Osm/Actions/ChangeTagAction"
 | 
			
		||||
  import { Tag } from "../../Logic/Tags/Tag"
 | 
			
		||||
  import { GeoOperations } from "../../Logic/GeoOperations"
 | 
			
		||||
  import type { Feature } from "geojson"
 | 
			
		||||
  import Translations from "../i18n/Translations"
 | 
			
		||||
  import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
 | 
			
		||||
  import type { ProvidedImage } from "../../Logic/ImageProviders/ImageProvider"
 | 
			
		||||
  import AttributedImage from "./AttributedImage.svelte"
 | 
			
		||||
  import SpecialTranslation from "../Popup/TagRendering/SpecialTranslation.svelte"
 | 
			
		||||
 | 
			
		||||
    export let tags: Store<OsmTags>
 | 
			
		||||
  export let tags: UIEventSource<OsmTags>
 | 
			
		||||
  export let lon: number
 | 
			
		||||
  export let lat: number
 | 
			
		||||
  export let state: SpecialVisualizationState
 | 
			
		||||
| 
						 | 
				
			
			@ -29,13 +29,13 @@
 | 
			
		|||
  const t = Translations.t.image.nearby
 | 
			
		||||
  const c = [lon, lat]
 | 
			
		||||
  const providedImage: ProvidedImage = {
 | 
			
		||||
      url: image.thumbUrl ?? image.pictureUrl,
 | 
			
		||||
      provider: AllImageProviders.byName(image.provider),
 | 
			
		||||
      date: new Date(image.date),
 | 
			
		||||
      id: Object.values(image.osmTags)[0]
 | 
			
		||||
    url: image.thumbUrl ?? image.pictureUrl,
 | 
			
		||||
    provider: AllImageProviders.byName(image.provider),
 | 
			
		||||
    date: new Date(image.date),
 | 
			
		||||
    id: Object.values(image.osmTags)[0],
 | 
			
		||||
  }
 | 
			
		||||
  let distance = Math.round(
 | 
			
		||||
    GeoOperations.distanceBetween([image.coordinates.lng, image.coordinates.lat], c)
 | 
			
		||||
    GeoOperations.distanceBetween([image.coordinates.lng, image.coordinates.lat], c),
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  $: {
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +44,7 @@
 | 
			
		|||
    const url = image.osmTags[key]
 | 
			
		||||
    if (isLinked) {
 | 
			
		||||
      const action = new LinkImageAction(currentTags.id, key, url, tags, {
 | 
			
		||||
        theme: tags.data._orig_theme ??  state.layout.id,
 | 
			
		||||
        theme: tags.data._orig_theme ?? state.layout.id,
 | 
			
		||||
        changeType: "link-image",
 | 
			
		||||
      })
 | 
			
		||||
      state.changes.applyAction(action)
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +65,7 @@
 | 
			
		|||
 | 
			
		||||
<div class="flex w-fit shrink-0 flex-col">
 | 
			
		||||
  <div on:click={() => state.previewedImage.setData(providedImage)}>
 | 
			
		||||
    <AttributedImage image={providedImage} imgClass="max-h-64 w-auto"/>
 | 
			
		||||
    <AttributedImage image={providedImage} imgClass="max-h-64 w-auto" />
 | 
			
		||||
  </div>
 | 
			
		||||
  {#if linkable}
 | 
			
		||||
    <label>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
  import { XCircleIcon } from "@babeard/svelte-heroicons/solid";
 | 
			
		||||
  import Camera_plus from "../../assets/svg/Camera_plus.svelte";
 | 
			
		||||
  import LoginToggle from "../Base/LoginToggle.svelte";
 | 
			
		||||
  import { ariaLabel } from "../../Utils/ariaLabel"
 | 
			
		||||
 | 
			
		||||
  export let tags: Store<OsmTags>;
 | 
			
		||||
  export let state: SpecialVisualizationState;
 | 
			
		||||
| 
						 | 
				
			
			@ -26,9 +27,11 @@
 | 
			
		|||
<LoginToggle {state}>
 | 
			
		||||
 | 
			
		||||
  {#if expanded}
 | 
			
		||||
    <NearbyImages {tags} {state} {lon} {lat} {feature} {linkable}>
 | 
			
		||||
    <NearbyImages {tags} {state} {lon} {lat} {feature} {linkable} {layer}>
 | 
			
		||||
      <button slot="corner"
 | 
			
		||||
              class="h-6 w-6 cursor-pointer no-image-background p-0 border-none"
 | 
			
		||||
              use:ariaLabel={t.close}
 | 
			
		||||
              
 | 
			
		||||
              on:click={() => {
 | 
			
		||||
        expanded = false
 | 
			
		||||
        }}>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue