File tree 1 file changed +15
-6
lines changed
1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,15 @@ IonicModule
32
32
this . $scope = $scope ;
33
33
this . $element = $element ;
34
34
35
- this . input = $element [ 0 ] . querySelector ( 'input,textarea' ) ;
35
+ this . setInputAriaLabeledBy = function ( id ) {
36
+ var inputs = $element [ 0 ] . querySelectorAll ( 'input,textarea' ) ;
37
+ inputs . length && inputs [ 0 ] . setAttribute ( 'aria-labelledby' , id ) ;
38
+ } ;
39
+
40
+ this . focus = function ( ) {
41
+ var inputs = $element [ 0 ] . querySelectorAll ( 'input,textarea' ) ;
42
+ inputs . length && inputs [ 0 ] . focus ( ) ;
43
+ } ;
36
44
} ]
37
45
} ;
38
46
} ] ) ;
@@ -79,12 +87,13 @@ IonicModule
79
87
$element . attr ( 'id' , id ) ;
80
88
}
81
89
82
- if ( ionInputCtrl && ionInputCtrl . input ) {
83
- ionInputCtrl . input . setAttribute ( 'aria-labelledby' , id ) ;
90
+ if ( ionInputCtrl ) {
91
+
92
+ ionInputCtrl . setInputAriaLabeledBy ( id ) ;
84
93
85
94
$element . on ( 'click' , function ( ) {
86
95
$timeout ( function ( ) {
87
- ionInputCtrl . input . focus ( ) ;
96
+ ionInputCtrl . focus ( ) ;
88
97
} ) ;
89
98
} ) ;
90
99
}
@@ -113,8 +122,8 @@ IonicModule
113
122
$element . attr ( 'id' , id ) ;
114
123
}
115
124
116
- if ( ionInputCtrl && ionInputCtrl . input ) {
117
- ionInputCtrl . input . setAttribute ( 'aria-labelledby' , id ) ;
125
+ if ( ionInputCtrl ) {
126
+ ionInputCtrl . setInputAriaLabeledBy ( id ) ;
118
127
}
119
128
120
129
} ;
You can’t perform that action at this time.
0 commit comments