File tree Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Expand file tree Collapse file tree 3 files changed +44
-4
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import messageInformation from "@ui5/webcomponents-icons/dist/message-informatio
7
7
import Label from "@ui5/webcomponents/dist/Label.js" ;
8
8
import Avatar from "@ui5/webcomponents/dist/Avatar.js" ;
9
9
import UI5Element from "@ui5/webcomponents-base" ;
10
+ import Input from "@ui5/webcomponents/dist/Input.js" ;
10
11
11
12
function Sample ( ) {
12
13
return < Timeline layout = "Vertical" accessibleName = "vertical" id = "timelineAccName" >
@@ -261,6 +262,41 @@ describe("Timeline with growing mode", () => {
261
262
. last ( )
262
263
. should ( "be.focused" ) ;
263
264
} ) ;
265
+
266
+ it ( "Arrows navigation should work only on focused item" , ( ) => {
267
+ cy . mount (
268
+ < Timeline >
269
+ < TimelineItem titleText = "first item" > </ TimelineItem >
270
+ < TimelineItem titleText = "second item" >
271
+ < Input id = "input" />
272
+ </ TimelineItem >
273
+ < TimelineItem titleText = "last item" > </ TimelineItem >
274
+ </ Timeline >
275
+ ) ;
276
+
277
+ cy . get ( "[ui5-timeline]" )
278
+ . as ( "timeline" ) ;
279
+
280
+ cy . get ( "#input" )
281
+ . realClick ( ) ;
282
+
283
+ cy . realPress ( "ArrowDown" ) ;
284
+
285
+ cy . get ( "@timeline" )
286
+ . find ( "ui5-timeline-item" )
287
+ . last ( )
288
+ . should ( "not.be.focused" ) ;
289
+
290
+ cy . get ( "#input" )
291
+ . realClick ( ) ;
292
+
293
+ cy . realPress ( "ArrowUp" ) ;
294
+
295
+ cy . get ( "@timeline" )
296
+ . find ( "ui5-timeline-item" )
297
+ . first ( )
298
+ . should ( "not.be.focused" ) ;
299
+ } ) ;
264
300
} ) ;
265
301
266
302
describe ( "Accessibility" , ( ) => {
Original file line number Diff line number Diff line change @@ -354,15 +354,17 @@ class Timeline extends UI5Element {
354
354
}
355
355
356
356
_onkeydown ( e : KeyboardEvent ) {
357
- const target = e . target as ITimelineItem ;
357
+ const target = e . target as ITimelineItem ,
358
+ targetfocusDomRef = target ?. getFocusDomRef ( ) ,
359
+ shouldHandleCustomArrowNavigation = targetfocusDomRef === this . getFocusDomRef ( ) || target === this . growingButton ;
358
360
359
- if ( isDown ( e ) || isRight ( e ) ) {
361
+ if ( shouldHandleCustomArrowNavigation && ( isDown ( e ) || isRight ( e ) ) ) {
360
362
this . _handleDown ( ) ;
361
363
e . preventDefault ( ) ;
362
364
return ;
363
365
}
364
366
365
- if ( isUp ( e ) || isLeft ( e ) ) {
367
+ if ( shouldHandleCustomArrowNavigation && ( isUp ( e ) || isLeft ( e ) ) ) {
366
368
this . _handleUp ( e ) ;
367
369
e . preventDefault ( ) ;
368
370
return ;
Original file line number Diff line number Diff line change @@ -27,7 +27,9 @@ <h2>Timeline within Card Vertical</h2>
27
27
</ ui5-card-header >
28
28
< ui5-timeline layout ="Vertical " accessible-name ="vertical " id ="timelineAccName ">
29
29
< ui5-timeline-item title-text ="called " subtitle-text ="20.02.2017 11:30 " icon ="phone "
30
- name ="Stanislava Baltova " name-clickable > </ ui5-timeline-item >
30
+ name ="Stanislava Baltova " name-clickable >
31
+ < ui5-input value ="Input "> </ ui5-input >
32
+ </ ui5-timeline-item >
31
33
< ui5-timeline-item title-text ="called " subtitle-text ="20.02.2017 11:30 " icon ="phone "
32
34
name ="Stanislava Baltova "> </ ui5-timeline-item >
33
35
< ui5-timeline-item title-text ="Weekly Sync - CP Design "
You can’t perform that action at this time.
0 commit comments