5nd*_*ndG 3 accessibility elm elm-ui
单击按钮时如何消除按钮周围的蓝色阴影?
我正在使用 Elm 和mdgriffith/elmui构建一个网络应用程序。
点击前按钮图片:
点击后:
榆木代码:
module Main exposing (main)
import Browser
import Element as E
import Element.Input as Ei
import Element.Border as Eb
main = E.layout [ E.padding 30 ] <|
Ei.button []
{ onPress = Nothing
, label = E.text "A button"
}
Run Code Online (Sandbox Code Playgroud)
如果可能的话,我不想使用任何 CSS。
编辑:
我不认为这是重复的,因为我的问题是关于如何使用 elm-ui 而不是 CSS 来做到这一点。
我要使用的解决方案是使用一些 CSS,因为我找不到在 elm-ui 中执行此操作的方法。这有效:
module Main exposing (main)
import Html.Attributes as Hat
import Element as E
import Element.Input as Ei
noOutline = E.htmlAttribute <| Hat.style "box-shadow" "none"
main = E.layout [ E.padding 30 ] <|
Ei.button [ noOutline ]
{ onPress = Nothing
, label = E.text "A button"
}
Run Code Online (Sandbox Code Playgroud)
(感谢 glennsl 的评论。)
为了避免使用 CSS,请考虑将layoutWith与focusStyle一起使用。
不幸的是,这是全局的,将应用于所有输入元素
编辑:实际上这看起来像
Element.layoutWith
{ options =
[ focusStyle
{ borderColor = Nothing
, backgroundColor = Nothing
, shadow = Nothing
}
]
}
listOfattrs
listOfchildren
Run Code Online (Sandbox Code Playgroud)