Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit 7aecc41

Browse files
committed
Adding optional Bootstrap sr-only class to label
when sr-only is a class on the label, the label will hide for non-screen-reader clients added labelSrOnly to common properties section
1 parent 0a6b0f4 commit 7aecc41

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ NOTE: All of these properties will be under the `templateOptions` property as of
5454
###### Default
5555
>`undefined`
5656
57+
---
58+
##### labelSrOnly (boolean)
59+
>`labelSrOnly` is used to add the sr-only class to a label so it will hide on non-screen-readers
60+
61+
###### Default
62+
>`undefined`
63+
5764
---
5865
##### required (boolean)
5966
>`required` is used to add the required attribute to a form field.

src/wrappers/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export default ngModule => {
99
apiCheck: check => ({
1010
templateOptions: {
1111
label: check.string,
12-
required: check.bool.optional
12+
required: check.bool.optional,
13+
labelSrOnly: check.bool.optional,
1314
}
1415
})
1516
},

src/wrappers/label.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div>
2-
<label for="{{id}}" class="control-label" ng-if="to.label">
2+
<label for="{{id}}" class="control-label {{to.labelSrOnly ? 'sr-only' : ''}}" ng-if="to.label">
33
{{to.label}}
44
{{to.required ? '*' : ''}}
55
</label>

0 commit comments

Comments
 (0)