MCPcopy Create free account
hub / github.com/UI5/webcomponents / focusFirstElementInCurrentStep

Method focusFirstElementInCurrentStep

packages/fiori/src/Wizard.ts:934–946  ·  view source on GitHub ↗

* Focuses the first focusable element in the currently selected step. * This helps screen readers announce the step change. * @private

()

Source from the content-addressed store, hash-verified

932 * @private
933 */
934 async focusFirstElementInCurrentStep() {
935 const currentStep = this.slottedSteps[this.selectedStepIndex];
936 if (!currentStep || currentStep.disabled) {
937 return;
938 }
939
940 const firstElementChild = currentStep.firstElementChild as HTMLElement;
941 const firstFocusableElement = await getFirstFocusableElement(firstElementChild);
942
943 if (firstFocusableElement) {
944 firstFocusableElement.focus();
945 }
946 }
947
948 /**
949 * Scrolls to the content item within the `ui5-wizard` shadowDOM

Callers 1

onAfterRenderingMethod · 0.95

Calls 2

getFirstFocusableElementFunction · 0.85
focusMethod · 0.45

Tested by

no test coverage detected