Skip to content

Commit

Permalink
Updated prop name
Browse files Browse the repository at this point in the history
  • Loading branch information
thatblindgeye committed Apr 26, 2024
1 parent 18a6331 commit 3133abd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions packages/react-core/src/components/Wizard/Wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
/** @beta Flag indicating whether the wizard content should be focused after the onNext or onBack callbacks
* are called.
*/
shouldFocusContentOnNextOrBack?: boolean;
shouldFocusContent?: boolean;
}

export const Wizard = ({
Expand All @@ -76,7 +76,7 @@ export const Wizard = ({
onStepChange,
onSave,
onClose,
shouldFocusContentOnNextOrBack = false,
shouldFocusContent = false,
...wrapperProps
}: WizardProps) => {
const [activeStepIndex, setActiveStepIndex] = React.useState(startIndex);
Expand Down Expand Up @@ -105,7 +105,7 @@ export const Wizard = ({

setActiveStepIndex(newStep?.index);
onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Next);
shouldFocusContentOnNextOrBack && focusMainContentElement();
shouldFocusContent && focusMainContentElement();
};

const goToPrevStep = (event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[] = initialSteps) => {
Expand All @@ -115,7 +115,7 @@ export const Wizard = ({

setActiveStepIndex(newStep?.index);
onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Back);
shouldFocusContentOnNextOrBack && focusMainContentElement();
shouldFocusContent && focusMainContentElement();
};

const goToStepByIndex = (
Expand Down Expand Up @@ -170,7 +170,7 @@ export const Wizard = ({
goToStepById={goToStepById}
goToStepByName={goToStepByName}
goToStepByIndex={goToStepByIndex}
shouldFocusContentOnNextOrBack={shouldFocusContentOnNextOrBack}
shouldFocusContent={shouldFocusContent}
mainWrapperRef={wrapperRef}
>
<div
Expand Down
4 changes: 2 additions & 2 deletions packages/react-core/src/components/Wizard/WizardBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const WizardBody = ({
const [hasScrollbar, setHasScrollbar] = React.useState(false);
const [previousWidth, setPreviousWidth] = React.useState<number | undefined>(undefined);
const WrapperComponent = component;
const { activeStep, shouldFocusContentOnNextOrBack, mainWrapperRef } = React.useContext(WizardContext);
const { activeStep, shouldFocusContent, mainWrapperRef } = React.useContext(WizardContext);
const defaultAriaLabel = ariaLabel || `${activeStep?.name} content`;

React.useEffect(() => {
Expand Down Expand Up @@ -71,7 +71,7 @@ export const WizardBody = ({
return (
<WrapperComponent
ref={mainWrapperRef}
{...(shouldFocusContentOnNextOrBack && { tabIndex: -1 })}
{...(shouldFocusContent && { tabIndex: -1 })}
{...(component === 'div' && hasScrollbar && { role: 'region' })}
{...(hasScrollbar && { 'aria-label': defaultAriaLabel, 'aria-labelledby': ariaLabelledBy, tabIndex: 0 })}
className={css(styles.wizardMain)}
Expand Down
8 changes: 4 additions & 4 deletions packages/react-core/src/components/Wizard/WizardContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface WizardContextProps {
/** Flag indicating whether the wizard content should be focused after the onNext or onBack callbacks
* are called.
*/
shouldFocusContentOnNextOrBack: boolean;
shouldFocusContent: boolean;
/** Ref for main wizard content element. */
mainWrapperRef: React.RefObject<HTMLElement>;
}
Expand All @@ -53,7 +53,7 @@ export interface WizardContextProviderProps {
steps: WizardStepType[],
index: number
): void;
shouldFocusContentOnNextOrBack: boolean;
shouldFocusContent: boolean;
mainWrapperRef: React.RefObject<HTMLElement>;
}

Expand All @@ -68,7 +68,7 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
goToStepById,
goToStepByName,
goToStepByIndex,
shouldFocusContentOnNextOrBack,
shouldFocusContent,
mainWrapperRef
}) => {
const [currentSteps, setCurrentSteps] = React.useState<WizardStepType[]>(initialSteps);
Expand Down Expand Up @@ -150,7 +150,7 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
(index: number) => goToStepByIndex(null, steps, index),
[goToStepByIndex, steps]
),
shouldFocusContentOnNextOrBack,
shouldFocusContent,
mainWrapperRef
}}
>
Expand Down

0 comments on commit 3133abd

Please sign in to comment.