From dfe012b4c9aea4828dc6266d4da337fbe27aa9f2 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Sun, 11 Aug 2019 16:40:45 +0200 Subject: [PATCH] Set focus on input on page load --- frontend/src/Main.elm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm index 8eb80a5..27e3aa5 100644 --- a/frontend/src/Main.elm +++ b/frontend/src/Main.elm @@ -10,7 +10,7 @@ module Main exposing import Browser import Data exposing (Url, hostname, toUrl) import Html exposing (Html, fieldset, input, label) -import Html.Attributes exposing (for, id, placeholder, readonly, style, value) +import Html.Attributes exposing (autofocus, for, id, placeholder, readonly, style, value) import Html.Events exposing (onInput) import Parse exposing (parseUrl) @@ -55,7 +55,15 @@ view : Model -> Html Msg view state = fieldset [] [ label [ for "url" ] [] - , input (myStyle [ id "url", placeholder "GitHub/GitLab/Bitbucket URL", value state.url, onInput UrlChange ]) + , input + (myStyle + [ id "url" + , placeholder "GitHub/GitLab/Bitbucket URL" + , value state.url + , onInput UrlChange + , autofocus True + ] + ) [] , label [ for "output" ] [] , input (myStyle [ id "output", readonly True, value (displayMUrl state.parsed) ]) []