From 8825bb9df2487057bb65b69df67c93e7d793a37a Mon Sep 17 00:00:00 2001 From: Yorhel Date: Thu, 28 Nov 2019 11:21:19 +0100 Subject: Use plain links for JS-ified linkradio inputs + fix focus of non-JS linkradios Kind of backwards to use input elements to display a link when they're backed by Javascript anyway. This also avoids the need to create a unique id for each linkradio element. --- elm/Lib/Html.elm | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'elm/Lib') diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm index 86c0f8f7..d75dced4 100644 --- a/elm/Lib/Html.elm +++ b/elm/Lib/Html.elm @@ -150,6 +150,12 @@ inputWikidata nam val onch = [ pattern "^Q?[1-9][0-9]{0,8}$" ] +-- Similar to inputCheck and inputRadio with a label, except this is just a link. +linkRadio : Bool -> (Bool -> m) -> List (Html m) -> Html m +linkRadio val onch content = + a [ href "#", onClickD (onch (not val)), class "linkradio", classList [("checked", val)] ] content + + -- Generate a form field (table row) with a label. The `label` string can be: -- -- "none" -> To generate a full-width field (colspan=2) -- cgit v1.2.3