Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8e4069b

Browse files
committedJan 5, 2021
Add semanticaly clicable button element to result list
- improves usability with keyboard #258 - improves accessbility See #259 for other relevant discussion
1 parent 01d682f commit 8e4069b

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed
 

‎src/Page/Options.elm

+17-2
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,9 @@ viewResultItem channel show item =
154154

155155
else
156156
[]
157+
158+
open =
159+
SearchMsg (Search.ShowDetails item.source.name)
157160
in
158161
[]
159162
-- DEBUG: |> List.append
@@ -175,10 +178,22 @@ viewResultItem channel show item =
175178
-- DEBUG: ]
176179
|> List.append
177180
(tr
178-
[ onClick (SearchMsg (Search.ShowDetails item.source.name))
181+
[ onClick open
179182
, Search.elementId item.source.name
180183
]
181-
[ td [] [ text item.source.name ]
184+
[ td []
185+
[ Html.button
186+
[ class "search-result-button"
187+
, Html.Events.custom "click" <|
188+
Json.Decode.succeed
189+
{ message = open
190+
, stopPropagation = True
191+
, preventDefault = True
192+
}
193+
]
194+
[ text item.source.name
195+
]
196+
]
182197
]
183198
:: packageDetails
184199
)

‎src/Page/Packages.elm

+16-2
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ viewResultItem channel show item =
194194

195195
else
196196
[]
197+
198+
open =
199+
SearchMsg (Search.ShowDetails item.source.attr_name)
197200
in
198201
[]
199202
-- DEBUG: |> List.append
@@ -222,10 +225,21 @@ viewResultItem channel show item =
222225
-- DEBUG: ]
223226
|> List.append
224227
(tr
225-
[ onClick (SearchMsg (Search.ShowDetails item.source.attr_name))
228+
[ onClick open
226229
, Search.elementId item.source.attr_name
227230
]
228-
[ td [] [ text <| item.source.attr_name ]
231+
[ td []
232+
[ Html.button
233+
[ class "search-result-button"
234+
, Html.Events.custom "click" <|
235+
Json.Decode.succeed
236+
{ message = open
237+
, stopPropagation = True
238+
, preventDefault = True
239+
}
240+
]
241+
[ text item.source.attr_name ]
242+
]
229243
, td [] [ text item.source.pname ]
230244
, td [] [ text item.source.pversion ]
231245
, td [] [ text <| Maybe.withDefault "" item.source.description ]

‎src/index.less

+7
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ header .navbar.navbar-static-top {
8888
tbody > td > dl > dd {
8989
margin-bottom: 1em;
9090
}
91+
92+
.search-result-button {
93+
margin: 0;
94+
padding: 0;
95+
border: 0;
96+
background: transparent;
97+
}
9198
}
9299

93100
.sort-form,

0 commit comments

Comments
 (0)
Please sign in to comment.