forked from MapComplete/MapComplete
		
	A11y: fix tab flow of RasterLayerPicker; see #1181
This commit is contained in:
		
							parent
							
								
									0cbacd57ec
								
							
						
					
					
						commit
						f5ba4bc3e4
					
				
					 2 changed files with 24 additions and 10 deletions
				
			
		| 
						 | 
					@ -13,7 +13,9 @@
 | 
				
			||||||
  import type { RasterLayerPolygon } from "../../Models/RasterLayers"
 | 
					  import type { RasterLayerPolygon } from "../../Models/RasterLayers"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  export let placedOverMapProperties: MapProperties
 | 
					  export let placedOverMapProperties: MapProperties
 | 
				
			||||||
  export let placedOverMap: UIEventSource<MlMap>
 | 
					  export let placedOverMap: Store<MlMap>
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  export let interactive: boolean = undefined
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  export let rasterLayer: UIEventSource<RasterLayerPolygon>
 | 
					  export let rasterLayer: UIEventSource<RasterLayerPolygon>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,4 +67,4 @@
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<MaplibreMap map={altmap} />
 | 
					<MaplibreMap {interactive} map={altmap} />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -63,30 +63,42 @@
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  function apply() {
 | 
				
			||||||
 | 
					    mapproperties.rasterLayer.setData(rasterLayer.data)
 | 
				
			||||||
 | 
					    dispatch("appliedLayer")
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  function handleKeyPress(e: KeyboardEvent){
 | 
				
			||||||
 | 
					    if(e.key === "Enter"){
 | 
				
			||||||
 | 
					      apply()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{#if hasLayers}
 | 
					{#if hasLayers}
 | 
				
			||||||
  <div class="flex h-full w-full flex-col">
 | 
					  <form class="flex h-full w-full flex-col">
 | 
				
			||||||
    <button
 | 
					    <button
 | 
				
			||||||
      on:click={() => {
 | 
					      tabindex="-1"
 | 
				
			||||||
        mapproperties.rasterLayer.setData(rasterLayer.data)
 | 
					      on:click={() => apply()}
 | 
				
			||||||
        dispatch("appliedLayer")
 | 
					      class="m-0 h-full w-full p-1 cursor-pointer"
 | 
				
			||||||
      }}
 | 
					 | 
				
			||||||
      class="m-0 h-full w-full p-0"
 | 
					 | 
				
			||||||
    >
 | 
					    >
 | 
				
			||||||
 | 
					      <div class="pointer-events-none w-full h-full">
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
      <OverlayMap
 | 
					      <OverlayMap
 | 
				
			||||||
 | 
					        interactive={false}
 | 
				
			||||||
        rasterLayer={rasterLayerOnMap}
 | 
					        rasterLayer={rasterLayerOnMap}
 | 
				
			||||||
        placedOverMap={map}
 | 
					        placedOverMap={map}
 | 
				
			||||||
        placedOverMapProperties={mapproperties}
 | 
					        placedOverMapProperties={mapproperties}
 | 
				
			||||||
        {visible}
 | 
					        {visible}
 | 
				
			||||||
      />
 | 
					      />
 | 
				
			||||||
 | 
					      </div>
 | 
				
			||||||
    </button>
 | 
					    </button>
 | 
				
			||||||
    <select bind:value={$rasterLayer} class="w-full">
 | 
					    <select bind:value={$rasterLayer} class="w-full" on:keydown={handleKeyPress}>
 | 
				
			||||||
      {#each $availableLayers as availableLayer}
 | 
					      {#each $availableLayers as availableLayer}
 | 
				
			||||||
        <option value={availableLayer}>
 | 
					        <option value={availableLayer}>
 | 
				
			||||||
          {availableLayer.properties.name}
 | 
					          {availableLayer.properties.name}
 | 
				
			||||||
        </option>
 | 
					        </option>
 | 
				
			||||||
      {/each}
 | 
					      {/each}
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
  </div>
 | 
					  </form>
 | 
				
			||||||
{/if}
 | 
					{/if}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue