Skip to content

Commit af038b7

Browse files
authored
Merge pull request #1604 from jprider63/optional-labels
Optional labels
2 parents c90c509 + 0f8441e commit af038b7

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

yesod-form/ChangeLog.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog for yesod-form
22

3+
## 1.6.5
4+
5+
* Add `.sr-only` to labels in `renderBootstrap3` when they are null.
6+
37
## 1.6.4
48

59
* Make FormResult an instance of Eq

yesod-form/Yesod/Form/Bootstrap3.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import Control.Arrow (second)
3232
import Control.Monad (liftM)
3333
import Data.Text (Text)
3434
import Data.String (IsString(..))
35+
import qualified Text.Blaze.Internal as Blaze
3536
import Yesod.Core
3637
import Yesod.Form.Types
3738
import Yesod.Form.Functions
@@ -154,7 +155,7 @@ renderBootstrap3 formLayout aform fragment = do
154155
$case formLayout
155156
$of BootstrapBasicForm
156157
$if fvId view /= bootstrapSubmitId
157-
<label for=#{fvId view}>#{fvLabel view}
158+
<label :Blaze.null (fvLabel view):.sr-only for=#{fvId view}>#{fvLabel view}
158159
^{fvInput view}
159160
^{helpWidget view}
160161
$of BootstrapInlineForm
@@ -164,7 +165,7 @@ renderBootstrap3 formLayout aform fragment = do
164165
^{helpWidget view}
165166
$of BootstrapHorizontalForm labelOffset labelSize inputOffset inputSize
166167
$if fvId view /= bootstrapSubmitId
167-
<label .control-label .#{toOffset labelOffset} .#{toColumn labelSize} for=#{fvId view}>#{fvLabel view}
168+
<label :Blaze.null (fvLabel view):.sr-only .control-label .#{toOffset labelOffset} .#{toColumn labelSize} for=#{fvId view}>#{fvLabel view}
168169
<div .#{toOffset inputOffset} .#{toColumn inputSize}>
169170
^{fvInput view}
170171
^{helpWidget view}

yesod-form/yesod-form.cabal

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: yesod-form
2-
version: 1.6.4
2+
version: 1.6.5
33
license: MIT
44
license-file: LICENSE
55
author: Michael Snoyman <[email protected]>

0 commit comments

Comments
 (0)