diff --git a/packages/base/src/features/F6Navigation.ts b/packages/base/src/features/F6Navigation.ts index fdf76bbbd6e2..613c33c111b4 100644 --- a/packages/base/src/features/F6Navigation.ts +++ b/packages/base/src/features/F6Navigation.ts @@ -100,10 +100,20 @@ class F6Navigation { // // // Here for both FCL & List the firstFoccusableElement is the same (the ui5-li) - const firstFocusable = await this.groupElementToFocus(this.groups[currentIndex - 1]); - const shouldSkipParent = firstFocusable === await this.groupElementToFocus(this.groups[currentIndex]); + const currentGroupFocusable = await this.groupElementToFocus(this.groups[currentIndex]); + let distanceToNextGroup = 1; - currentIndex = shouldSkipParent ? currentIndex - 2 : currentIndex - 1; + for (let distanceIndex = 1; distanceIndex < this.groups.length; distanceIndex++) { + const firstFocusable = await this.groupElementToFocus(this.groups[currentIndex - distanceIndex]); + + if (firstFocusable === currentGroupFocusable) { + distanceToNextGroup++; + } else { + break; + } + } + + currentIndex -= distanceToNextGroup; if (currentIndex < 0) { currentIndex = this.groups.length - 1; diff --git a/packages/main/cypress/specs/F6.cy.tsx b/packages/main/cypress/specs/F6.cy.tsx index dc9d0c44af84..9271c3188bec 100644 --- a/packages/main/cypress/specs/F6.cy.tsx +++ b/packages/main/cypress/specs/F6.cy.tsx @@ -256,7 +256,9 @@ describe("F6 navigation", () => {
- +
+ +
@@ -264,14 +266,20 @@ describe("F6 navigation", () => {
- +
+
+
+ +
+
+
- +
@@ -670,7 +678,9 @@ describe("F6 navigation", () => {
- +
+ +
@@ -678,14 +688,20 @@ describe("F6 navigation", () => {
- +
+
+
+ +
+
+
- +
diff --git a/packages/main/test/pages/F6Test9.html b/packages/main/test/pages/F6Test9.html new file mode 100644 index 000000000000..40e5c187849e --- /dev/null +++ b/packages/main/test/pages/F6Test9.html @@ -0,0 +1,52 @@ + + + + + + + Avatar + + + + + + + + + +
+ Before element +
+
+
+
+ First focusable +
+
+
+
+ Something focusable +
+
+
+
+
+
+ Second focusable +
+
+
+
+
+
+ Something focusable +
+
+ Third focusable +
+
+ After Element +
+ + + \ No newline at end of file