git.iko.soy/typeable/elm-ui
on master help sign in
Closes #86 - removes <p> tag in favor of a plain div.
commit23a43a2afa76b69333b1b308733934231f26029d authorMatthew Griffith <mdg.griffith@gmail.com> dateWed 17 Jul 2019, 09:01 (7 years ago) parent81582bf
1 file changed+35−31
src/Internal/Model.elm+35−31
src/Internal/Model.elm+35−31
@@ -1141,24 +1141,18 @@ gatherAttrRecursive classes node has transform styles attrs children elementAttr
11411141 gatherAttrRecursive classes (addNodeName "h6" node) has transform styles attrs children remaining
11421142
11431143 Paragraph ->
1144− let
1145− newNode =
1146− case node of
1147− Generic ->
1148− NodeName "p"
1149−
1150− NodeName name ->
1151− NodeName name
1152−
1153− Embedded x y ->
1154− Embedded x y
1155− in
1156− gatherAttrRecursive classes
1157− newNode
1144+ -- previously we rendered a <p> tag, though apparently this invalidates the html if it has <div>s inside.
1145+ -- Since we can't guaranteee that there are no divs, we need another strategy.
1146+ -- While it's not documented in many places, there apparently is a paragraph aria role
1147+ -- maybe it doesn't do anything, but it might help.
1148+ -- https://github.com/w3c/aria/blob/11f85f41a5b621fdbe85fc9bcdcd270e653a48ba/common/script/roleInfo.js
1149+ gatherAttrRecursive
1150+ classes
1151+ node
11581152 has
11591153 transform
11601154 styles
1161− attrs
1155+ (VirtualDom.attribute "role" "paragraph" :: attrs)
11621156 children
11631157 remaining
11641158
@@ -2043,34 +2037,44 @@ getHeight attrs =
20432037 Nothing
20442038
20452039
2040+textElementClasses : String
2041+textElementClasses =
2042+ classes.any
2043+ ++ " "
2044+ ++ classes.text
2045+ ++ " "
2046+ ++ classes.widthContent
2047+ ++ " "
2048+ ++ classes.heightContent
2049+
2050+
20462051textElement : String -> VirtualDom.Node msg
20472052textElement str =
20482053 Html.div
20492054 [ Html.Attributes.class
2050− (String.join " "
2051− [ classes.any
2052− , classes.text
2053− , classes.widthContent
2054− , classes.heightContent
2055− ]
2056− )
2055+ textElementClasses
20572056 ]
20582057 [ Html.text str ]
20592058
20602059
2060+textElementFillClasses : String
2061+textElementFillClasses =
2062+ classes.any
2063+ ++ " "
2064+ ++ classes.text
2065+ ++ " "
2066+ ++ classes.widthFill
2067+ ++ " "
2068+ ++ classes.heightFill
2069+
2070+
20612071textElementFill : String -> VirtualDom.Node msg
20622072textElementFill str =
2063− VirtualDom.node "div"
2073+ Html.div
20642074 [ Html.Attributes.class
2065− (String.join " "
2066− [ classes.any
2067− , classes.text
2068− , classes.widthFill
2069− , classes.heightFill
2070− ]
2071− )
2075+ textElementFillClasses
20722076 ]
2073− [ VirtualDom.text str ]
2077+ [ Html.text str ]
20742078
20752079
20762080type Children x