File tree 6 files changed +73
-10
lines changed
6 files changed +73
-10
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
2
2
import "@ui5/webcomponents-icons/dist/fob-watch.js" ;
3
3
import TimePickerBase from "./TimePickerBase.js" ;
4
4
5
+ import {
6
+ DURATION_INPUT_DESCRIPTION ,
7
+ } from "./generated/i18n/i18n-defaults.js" ;
8
+
5
9
/**
6
10
* @public
7
11
*/
@@ -286,6 +290,21 @@ class DurationPicker extends TimePickerBase {
286
290
get maxSeconds ( ) {
287
291
return parseInt ( this . maxValue . split ( ":" ) [ 2 ] ) ;
288
292
}
293
+
294
+ get dateAriaDescription ( ) {
295
+ return this . i18nBundle . getText ( DURATION_INPUT_DESCRIPTION ) ;
296
+ }
297
+
298
+ get accInfo ( ) {
299
+ return {
300
+ "ariaRoledescription" : this . dateAriaDescription ,
301
+ "ariaHasPopup" : "dialog" ,
302
+ "ariaAutoComplete" : "none" ,
303
+ "role" : "combobox" ,
304
+ "ariaControls" : `${ this . _id } -responsive-popover` ,
305
+ "ariaExpanded" : this . isOpen ( ) ,
306
+ } ;
307
+ }
289
308
}
290
309
291
310
DurationPicker . define ( ) ;
Original file line number Diff line number Diff line change 6
6
?disabled =" {{ disabled }} "
7
7
?readonly =" {{ readonly }} "
8
8
value-state =" {{ valueState }} "
9
+ ._inputAccInfo =" {{ accInfo }} "
9
10
@click =" {{ _handleInputClick }} "
10
11
@ui5-change =" {{ _handleInputChange }} "
11
12
@ui5-input =" {{ _handleInputLiveChange }} "
Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import getLocale from "@ui5/webcomponents-base/dist/locale/getLocale.js";
2
2
import getCachedLocaleDataInstance from "@ui5/webcomponents-localization/dist/getCachedLocaleDataInstance.js" ;
3
3
import TimePickerBase from "./TimePickerBase.js" ;
4
4
5
+ import {
6
+ TIMEPICKER_INPUT_DESCRIPTION ,
7
+ } from "./generated/i18n/i18n-defaults.js" ;
8
+
5
9
/**
6
10
* @public
7
11
*/
@@ -140,6 +144,21 @@ class TimePicker extends TimePickerBase {
140
144
get dateValue ( ) {
141
145
return this . getFormat ( ) . parse ( this . _effectiveValue ) ;
142
146
}
147
+
148
+ get accInfo ( ) {
149
+ return {
150
+ "ariaRoledescription" : this . dateAriaDescription ,
151
+ "ariaHasPopup" : "dialog" ,
152
+ "ariaAutoComplete" : "none" ,
153
+ "role" : "combobox" ,
154
+ "ariaControls" : `${ this . _id } -responsive-popover` ,
155
+ "ariaExpanded" : this . isOpen ( ) ,
156
+ } ;
157
+ }
158
+
159
+ get dateAriaDescription ( ) {
160
+ return this . i18nBundle . getText ( TIMEPICKER_INPUT_DESCRIPTION ) ;
161
+ }
143
162
}
144
163
145
164
TimePicker . define ( ) ;
Original file line number Diff line number Diff line change 19
19
<div id =" {{ this._id }} --selection-frame" class =" ui5-wheelslider-selection-frame" ></div >
20
20
<div id =" {{ this._id }} --wrapper" class =" ui5-wheelslider-wrapper" >
21
21
{{ #if expanded }}
22
- <ul id =" {{ this._id }} --items-list" >
22
+ <ul id =" {{ this._id }} --items-list" role = " listbox " aria-label = " {{ label }} " >
23
23
{{ #each _itemsToShow }}
24
- <li class =" ui5-wheelslider-item" data-item-index =" {{ @index }} " style =" list-style-type: none;" >{{ this }} </li >
24
+ <li class =" ui5-wheelslider-item"
25
+ data-item-index =" {{ @index }} "
26
+ role =" option"
27
+ aria-selected =" {{ this.selected }} "
28
+ style =" list-style-type: none;" >
29
+ {{ this.value }}
30
+ </li >
25
31
{{ /each }}
26
32
</ul >
27
33
{{ else }}
28
- <ul id =" {{ this._id }} --items-list" >
29
- <li class =" ui5-wheelslider-item" style =" list-style-type: none;" >{{ value }} </li >
34
+ <ul id =" {{ this._id }} --items-list" role =" listbox" aria-label =" {{ label }} " >
35
+ <li class =" ui5-wheelslider-item"
36
+ role =" option"
37
+ aria-selected =" true"
38
+ style =" list-style-type: none;" >
39
+ {{ value }}
40
+ </li >
30
41
</ul >
31
42
{{ /if }}
32
43
</div >
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ const metadata = {
76
76
} ,
77
77
78
78
_itemsToShow : {
79
- type : String ,
79
+ type : Object ,
80
80
multiple : true ,
81
81
} ,
82
82
@@ -248,7 +248,7 @@ class WheelSlider extends UI5Element {
248
248
249
249
offsetIndex = Math . round ( scrollWhere / cellSizeInPx ) ;
250
250
251
- if ( this . value === this . _itemsToShow [ offsetIndex ] ) {
251
+ if ( this . value === this . _itemsToShow [ offsetIndex ] . value ) {
252
252
return ;
253
253
}
254
254
@@ -259,7 +259,7 @@ class WheelSlider extends UI5Element {
259
259
}
260
260
}
261
261
262
- this . value = this . _itemsToShow [ offsetIndex ] ;
262
+ this . value = this . _itemsToShow [ offsetIndex ] . value ;
263
263
this . _currentElementIndex = offsetIndex ;
264
264
}
265
265
@@ -311,14 +311,21 @@ class WheelSlider extends UI5Element {
311
311
}
312
312
313
313
_buildItemsToShow ( ) {
314
- this . _itemsToShow = this . _items ;
314
+ let itemsToShow = this . _items ;
315
315
if ( this . cyclic ) {
316
- if ( this . _itemsToShow . length < this . _items . length * this . _timesMultipliedOnCyclic ( ) ) {
316
+ if ( itemsToShow . length < this . _items . length * this . _timesMultipliedOnCyclic ( ) ) {
317
317
for ( let i = 0 ; i < this . _timesMultipliedOnCyclic ( ) ; i ++ ) {
318
- this . _itemsToShow = this . _itemsToShow . concat ( this . _items ) ;
318
+ itemsToShow = itemsToShow . concat ( this . _items ) ;
319
319
}
320
320
}
321
321
}
322
+
323
+ this . _itemsToShow = itemsToShow . map ( value => {
324
+ return {
325
+ value,
326
+ "selected" : ( value === this . value ) ,
327
+ } ;
328
+ } ) ;
322
329
}
323
330
324
331
_handleArrayBorderReached ( currentIndex ) {
Original file line number Diff line number Diff line change @@ -205,6 +205,12 @@ TIMEPICKER_SUBMIT_BUTTON=OK
205
205
# XFLD: Timepicker popover button
206
206
TIMEPICKER_CANCEL_BUTTON =Cancel
207
207
208
+ # XACT: Aria information for the Time Picker
209
+ TIMEPICKER_INPUT_DESCRIPTION =Time Input
210
+
211
+ # XACT: Aria information for the Duration Picker
212
+ DURATION_INPUT_DESCRIPTION =Duration Input
213
+
208
214
# XFLD: DateTimePicker popover button
209
215
DATETIME_PICKER_DATE_BUTTON =Date
210
216
You can’t perform that action at this time.
0 commit comments