git.iko.soy/typeable/elm-ui
on master help sign in
Closes #86 - removes <p> tag in favor of a plain div.
23a43a2Matthew Griffith
src/Internal/Model.elm+35−31
@@ -1141,24 +1141,18 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
1141 gatherAttrRecursive classes (addNodeName "h6" node) has transform styles attrs children remaining
1141 gatherAttrRecursive classes (addNodeName "h6" node) has transform styles attrs children remaining
1142
1142
1143 Paragraph ->
1143 Paragraph ->
1144− let
1144+ -- previously we rendered a <p> tag, though apparently this invalidates the html if it has <div>s inside.
1145− newNode =
1145+ -- Since we can't guaranteee that there are no divs, we need another strategy.
1146− case node of
1146+ -- While it's not documented in many places, there apparently is a paragraph aria role
1147− Generic ->
1147+ -- maybe it doesn't do anything, but it might help.
1148− NodeName "p"
1148+ -- https://github.com/w3c/aria/blob/11f85f41a5b621fdbe85fc9bcdcd270e653a48ba/common/script/roleInfo.js
1149−
1150− NodeName name ->
1151− NodeName name
1152−
1153− Embedded x y ->
1154− Embedded x y
1155− in
1156− gatherAttrRecursive classes
1149+ gatherAttrRecursive
1157− newNode
1150+ classes
1151+ node
1158 has
1152 has
1159 transform
1153 transform
1160 styles
1154 styles
1161− attrs
1155+ (VirtualDom.attribute "role" "paragraph" :: attrs)
1162 children
1156 children
1163 remaining
1157 remaining
1164
1158
@@ -2043,34 +2037,44 @@ getHeight attrs =
2043 Nothing
2037 Nothing
2044
2038
2045
2039
2040+textElementClasses : String
2041+textElementClasses =
2042+ classes.any
2043+ ++ " "
2044+ ++ classes.text
2045+ ++ " "
2046+ ++ classes.widthContent
2047+ ++ " "
2048+ ++ classes.heightContent
2049+
2050+
2046textElement : String -> VirtualDom.Node msg
2051textElement : String -> VirtualDom.Node msg
2047textElement str =
2052textElement str =
2048 Html.div
2053 Html.div
2049 [ Html.Attributes.class
2054 [ Html.Attributes.class
2050− (String.join " "
2055+ textElementClasses
2051− [ classes.any
2052− , classes.text
2053− , classes.widthContent
2054− , classes.heightContent
2055− ]
2056− )
2057 ]
2056 ]
2058 [ Html.text str ]
2057 [ Html.text str ]
2059
2058
2060
2059
2060+textElementFillClasses : String
2061+textElementFillClasses =
2062+ classes.any
2063+ ++ " "
2064+ ++ classes.text
2065+ ++ " "
2066+ ++ classes.widthFill
2067+ ++ " "
2068+ ++ classes.heightFill
2069+
2070+
2061textElementFill : String -> VirtualDom.Node msg
2071textElementFill : String -> VirtualDom.Node msg
2062textElementFill str =
2072textElementFill str =
2063− VirtualDom.node "div"
2073+ Html.div
2064 [ Html.Attributes.class
2074 [ Html.Attributes.class
2065− (String.join " "
2075+ textElementFillClasses
2066− [ classes.any
2067− , classes.text
2068− , classes.widthFill
2069− , classes.heightFill
2070− ]
2071− )
2072 ]
2076 ]
2073− [ VirtualDom.text str ]
2077+ [ Html.text str ]
2074
2078
2075
2079
2076type Children x
2080type Children x