From 3b1a4c708bbe73d22c4240f4acc78db0e76336b7 Mon Sep 17 00:00:00 2001 From: Stefan Dimitrov Date: Wed, 12 Nov 2025 15:57:53 +0200 Subject: [PATCH 1/2] feat(ui5-wizard): getFocusDomRef added --- packages/fiori/cypress/specs/Wizard.cy.tsx | 81 ++++++++++++++++++++++ packages/fiori/src/Wizard.ts | 4 ++ 2 files changed, 85 insertions(+) diff --git a/packages/fiori/cypress/specs/Wizard.cy.tsx b/packages/fiori/cypress/specs/Wizard.cy.tsx index 60cc05223d2e..778aa61d69bd 100644 --- a/packages/fiori/cypress/specs/Wizard.cy.tsx +++ b/packages/fiori/cypress/specs/Wizard.cy.tsx @@ -633,4 +633,85 @@ describe("Wizard inside Dialog", () => { .find("[ui5-responsive-popover]") .should("be.visible"); }); +}); + +describe("Wizard - getFocusDomRef Method", () => { + it("should focus the last focused wizard tab on wizard focus", () => { + const onButtonClick = () => { + document.getElementById("wizard").focus(); + } + cy.mount( + <> + + + + The Wizard control is supposed to break down large tasks. + + + + + + + + + ); + + cy.get("[ui5-wizard]") + .shadow() + .find("[ui5-wizard-tab]") + .eq(2) + .realClick(); + + cy.get("[ui5-button]") + .eq(0) + .realClick(); + + cy.get("[ui5-button]") + .eq(1) + .realClick(); + + cy.get("[ui5-wizard]") + .shadow() + .find("[ui5-wizard-tab]") + .eq(2) + .shadow() + .find(".ui5-wiz-step-root") + .should("be.focused"); + }); + + it("should focus the first wizard tab if no tab was focused before ", () => { + const onButtonClick = () => { + document.getElementById("wizard").focus(); + } + cy.mount( + <> + + + + + + + + ); + + cy.get("[ui5-button]") + .realClick(); + + cy.get("[ui5-wizard]") + .shadow() + .find("[ui5-wizard-tab]") + .eq(0) + .shadow() + .find(".ui5-wiz-step-root") + .should("be.focused"); + }); + + it("should return undefined when the Wizard is empty", () => { + cy.mount(); + + cy.get("[ui5-wizard]") + .then(($el) => { + expect($el[0].getFocusDomRef()).to.be.undefined; + }); + }); }); \ No newline at end of file diff --git a/packages/fiori/src/Wizard.ts b/packages/fiori/src/Wizard.ts index 1fdfd75da414..5bfd1b49416f 100644 --- a/packages/fiori/src/Wizard.ts +++ b/packages/fiori/src/Wizard.ts @@ -694,6 +694,10 @@ class Wizard extends UI5Element { return contentHeight; } + getFocusDomRef() { + return this._itemNavigation._getCurrentItem(); + } + getStepAriaLabelText(step: WizardStep, ariaLabel: string) { return Wizard.i18nBundle.getText(WIZARD_STEP_ARIA_LABEL, ariaLabel); } From e03c74c556b06c67b3df4d9ada58a3c7f415d9ec Mon Sep 17 00:00:00 2001 From: Stefan Dimitrov Date: Tue, 18 Nov 2025 09:23:18 +0200 Subject: [PATCH 2/2] feat(ui5-wizard): resolve comments --- packages/fiori/cypress/specs/Wizard.cy.tsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/packages/fiori/cypress/specs/Wizard.cy.tsx b/packages/fiori/cypress/specs/Wizard.cy.tsx index 778aa61d69bd..183479dc9b4b 100644 --- a/packages/fiori/cypress/specs/Wizard.cy.tsx +++ b/packages/fiori/cypress/specs/Wizard.cy.tsx @@ -705,13 +705,4 @@ describe("Wizard - getFocusDomRef Method", () => { .find(".ui5-wiz-step-root") .should("be.focused"); }); - - it("should return undefined when the Wizard is empty", () => { - cy.mount(); - - cy.get("[ui5-wizard]") - .then(($el) => { - expect($el[0].getFocusDomRef()).to.be.undefined; - }); - }); }); \ No newline at end of file