X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/163775c3501257af8f62601b0bb3565133c3bebb..437201f4e2c0a9e2fc25ac3dc51d67f11c351728:/src/components/ResultsList.svelte

diff --git a/src/components/ResultsList.svelte b/src/components/ResultsList.svelte
index 8c68bb3..8935ec1 100644
--- a/src/components/ResultsList.svelte
+++ b/src/components/ResultsList.svelte
@@ -1,12 +1,13 @@
 <script>
   import { results_store } from '../lib/stores.js';
-  import { formatLabel, detailsURL } from '../lib/helpers.js';
+  import { formatLabel } from '../lib/helpers.js';
 
+  import DetailsLink from './DetailsLink.svelte';
   import Welcome from './Welcome.svelte';
   import MapIcon from './MapIcon.svelte';
 
   export let reverse_search = false;
-  export let current_result = {};
+  export let current_result = null;
 
   let aSearchResults;
   let iHighlightNum;
@@ -52,18 +53,26 @@
 </script>
 
 {#if aSearchResults && aSearchResults.length > 0}
-  <div id="searchresults">
+  <div id="searchresults" role="list">
 
     {#each aSearchResults as aResult, iResNum}
-      <div class="result" class:highlight={iResNum === iHighlightNum} data-position="{iResNum}" on:click|stopPropagation={handleClick}>
+      <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
+      <div class="result"
+           class:highlight={iResNum === iHighlightNum}
+           role="listitem"
+           data-position="{iResNum}"
+           on:click|stopPropagation={handleClick}
+           on:keypress|stopPropagation={handleClick}>
         <div style="float:right">
           <MapIcon aPlace={aResult} />
         </div>
         <span class="name">{aResult.display_name}</span>
         <span class="type">{formatLabel(aResult)}</span>
-        <p class="coords">{aResult.lat},{aResult.lon}</p>  
+        <p class="coords">{aResult.lat},{aResult.lon}</p>
 
-        <a class="details btn btn-outline-secondary btn-sm" href="{detailsURL(aResult)}">details</a>
+        <DetailsLink extra_classes="btn btn-outline-secondary btn-sm" feature={aResult}>
+          details
+        </DetailsLink>
       </div>
     {/each}
 
@@ -102,22 +111,23 @@
     background-color: #D9E7F7;
     border-color: #9DB9E4;
   }
-  .result.highlight .details {
+  .result.highlight :global(a) {
     margin: 10px auto;
     display: block;
     max-width: 10em;
     padding: 1px;
+    background-color: white;
   }
   .result .type{
     color: gray;
     font-size: 0.8em;
   }
-  .result .details {
+  .result :global(a) {
     display: none;
   }
 
   .result .coords {
-    display: none;  
+    display: none;
   }
 
   .noresults{
@@ -130,11 +140,7 @@
     margin-top: 1em;
   }
 
-  .btn-outline-secondary {
-    background-color: white;
-  }
-
-  .btn-outline-secondary:hover {
+  .result.highlight :global(a):hover {
     color: #111;
   }
 </style>
