File tree 2 files changed +32
-3
lines changed
2 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 4
4
aria-checked =" {{ checked }} "
5
5
aria-readonly =" {{ ariaReadonly }} "
6
6
aria-disabled =" {{ ariaDisabled }} "
7
- aria-label =" {{ ariaLabel }} "
7
+ aria-label =" {{ ariaLabelText }} "
8
8
aria-labelledby =" {{ ariaLabelledBy }} "
9
9
aria-describedby =" {{ ariaDescribedBy }} "
10
10
tabindex =" {{ tabIndex }} "
18
18
<ui5-icon name =" accept" class =" ui5-checkbox-icon" ></ui5-icon >
19
19
{{ /if }}
20
20
21
- <input id =" {{ _id }} -CB" type =' checkbox' ?checked =" {{ checked }} " ?readonly =" {{ readonly }} " ?disabled =" {{ disabled }} " data-sap-no-tab-ref/>
21
+ <input
22
+ id =" {{ _id }} -CB"
23
+ type =' checkbox'
24
+ ?checked =" {{ checked }} "
25
+ ?readonly =" {{ readonly }} "
26
+ ?disabled =" {{ disabled }} "
27
+ role =" none"
28
+ data-sap-no-tab-ref
29
+ />
22
30
</div >
23
31
24
32
{{ #if _label.text }}
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { isDesktop } from "@ui5/webcomponents-base/dist/Device.js";
2
2
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js" ;
3
3
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js" ;
4
4
import { fetchI18nBundle , getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js" ;
5
+ import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js" ;
5
6
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js" ;
6
7
import { getFeature } from "@ui5/webcomponents-base/dist/FeaturesRegistry.js" ;
7
8
import { isSpace , isEnter } from "@ui5/webcomponents-base/dist/Keys.js" ;
@@ -136,6 +137,18 @@ const metadata = {
136
137
defaultValue : undefined ,
137
138
} ,
138
139
140
+ /**
141
+ * Receives id(or many ids) of the elements that label the checkbox
142
+ * @type {String }
143
+ * @defaultvalue ""
144
+ * @private
145
+ * @since 1.0.0-rc.9
146
+ */
147
+ ariaLabelledby : {
148
+ type : String ,
149
+ defaultValue : "" ,
150
+ } ,
151
+
139
152
_label : {
140
153
type : Object ,
141
154
} ,
@@ -297,8 +310,16 @@ class CheckBox extends UI5Element {
297
310
return this . disabled ? "true" : undefined ;
298
311
}
299
312
313
+ get ariaLabelText ( ) {
314
+ return getEffectiveAriaLabelText ( this ) ;
315
+ }
316
+
300
317
get ariaLabelledBy ( ) {
301
- return this . text ? `${ this . _id } -label` : undefined ;
318
+ if ( ! this . ariaLabelText ) {
319
+ return this . text ? `${ this . _id } -label` : undefined ;
320
+ }
321
+
322
+ return undefined ;
302
323
}
303
324
304
325
get ariaDescribedBy ( ) {
You can’t perform that action at this time.
0 commit comments