Set focus on input on page load
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Valentin Brandl 2019-08-11 16:40:45 +02:00
parent 387b6241a2
commit dfe012b4c9
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -10,7 +10,7 @@ module Main exposing
import Browser import Browser
import Data exposing (Url, hostname, toUrl) import Data exposing (Url, hostname, toUrl)
import Html exposing (Html, fieldset, input, label) 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 Html.Events exposing (onInput)
import Parse exposing (parseUrl) import Parse exposing (parseUrl)
@ -55,7 +55,15 @@ view : Model -> Html Msg
view state = view state =
fieldset [] fieldset []
[ label [ for "url" ] [] [ 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" ] [] , label [ for "output" ] []
, input (myStyle [ id "output", readonly True, value (displayMUrl state.parsed) ]) [] , input (myStyle [ id "output", readonly True, value (displayMUrl state.parsed) ]) []