@patternfly/react-core 5.4.0-prerelease.4 → 5.4.0-prerelease.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/components/package.json +1 -1
  3. package/deprecated/package.json +1 -1
  4. package/dist/dynamic/components/AboutModal/package.json +1 -1
  5. package/dist/dynamic/components/Accordion/package.json +1 -1
  6. package/dist/dynamic/components/ActionList/package.json +1 -1
  7. package/dist/dynamic/components/Alert/package.json +1 -1
  8. package/dist/dynamic/components/Avatar/package.json +1 -1
  9. package/dist/dynamic/components/BackToTop/package.json +1 -1
  10. package/dist/dynamic/components/Backdrop/package.json +1 -1
  11. package/dist/dynamic/components/BackgroundImage/package.json +1 -1
  12. package/dist/dynamic/components/Badge/package.json +1 -1
  13. package/dist/dynamic/components/Banner/package.json +1 -1
  14. package/dist/dynamic/components/Brand/package.json +1 -1
  15. package/dist/dynamic/components/Breadcrumb/package.json +1 -1
  16. package/dist/dynamic/components/Button/package.json +1 -1
  17. package/dist/dynamic/components/CalendarMonth/package.json +1 -1
  18. package/dist/dynamic/components/Card/package.json +1 -1
  19. package/dist/dynamic/components/Checkbox/package.json +1 -1
  20. package/dist/dynamic/components/Chip/package.json +1 -1
  21. package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
  22. package/dist/dynamic/components/CodeBlock/package.json +1 -1
  23. package/dist/dynamic/components/DataList/package.json +1 -1
  24. package/dist/dynamic/components/DatePicker/package.json +1 -1
  25. package/dist/dynamic/components/DescriptionList/package.json +1 -1
  26. package/dist/dynamic/components/Divider/package.json +1 -1
  27. package/dist/dynamic/components/DragDrop/package.json +1 -1
  28. package/dist/dynamic/components/Drawer/package.json +1 -1
  29. package/dist/dynamic/components/Dropdown/package.json +1 -1
  30. package/dist/dynamic/components/DualListSelector/package.json +1 -1
  31. package/dist/dynamic/components/EmptyState/package.json +1 -1
  32. package/dist/dynamic/components/ExpandableSection/package.json +1 -1
  33. package/dist/dynamic/components/FileUpload/package.json +1 -1
  34. package/dist/dynamic/components/Form/package.json +1 -1
  35. package/dist/dynamic/components/FormSelect/package.json +1 -1
  36. package/dist/dynamic/components/HelperText/package.json +1 -1
  37. package/dist/dynamic/components/Hint/package.json +1 -1
  38. package/dist/dynamic/components/Icon/package.json +1 -1
  39. package/dist/dynamic/components/InputGroup/package.json +1 -1
  40. package/dist/dynamic/components/JumpLinks/package.json +1 -1
  41. package/dist/dynamic/components/Label/package.json +1 -1
  42. package/dist/dynamic/components/List/package.json +1 -1
  43. package/dist/dynamic/components/LoginPage/package.json +1 -1
  44. package/dist/dynamic/components/Masthead/package.json +1 -1
  45. package/dist/dynamic/components/Menu/package.json +1 -1
  46. package/dist/dynamic/components/MenuToggle/package.json +1 -1
  47. package/dist/dynamic/components/Modal/package.json +1 -1
  48. package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
  49. package/dist/dynamic/components/Nav/package.json +1 -1
  50. package/dist/dynamic/components/NotificationBadge/package.json +1 -1
  51. package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
  52. package/dist/dynamic/components/NumberInput/package.json +1 -1
  53. package/dist/dynamic/components/OverflowMenu/package.json +1 -1
  54. package/dist/dynamic/components/Page/package.json +1 -1
  55. package/dist/dynamic/components/Pagination/package.json +1 -1
  56. package/dist/dynamic/components/Panel/package.json +1 -1
  57. package/dist/dynamic/components/Popover/package.json +1 -1
  58. package/dist/dynamic/components/Progress/package.json +1 -1
  59. package/dist/dynamic/components/ProgressStepper/package.json +1 -1
  60. package/dist/dynamic/components/Radio/package.json +1 -1
  61. package/dist/dynamic/components/SearchInput/package.json +1 -1
  62. package/dist/dynamic/components/Select/package.json +1 -1
  63. package/dist/dynamic/components/Sidebar/package.json +1 -1
  64. package/dist/dynamic/components/SimpleList/package.json +1 -1
  65. package/dist/dynamic/components/Skeleton/package.json +1 -1
  66. package/dist/dynamic/components/SkipToContent/package.json +1 -1
  67. package/dist/dynamic/components/Slider/package.json +1 -1
  68. package/dist/dynamic/components/Spinner/package.json +1 -1
  69. package/dist/dynamic/components/Switch/package.json +1 -1
  70. package/dist/dynamic/components/Tabs/package.json +1 -1
  71. package/dist/dynamic/components/Text/package.json +1 -1
  72. package/dist/dynamic/components/TextArea/package.json +1 -1
  73. package/dist/dynamic/components/TextInput/package.json +1 -1
  74. package/dist/dynamic/components/TextInputGroup/package.json +1 -1
  75. package/dist/dynamic/components/Tile/package.json +1 -1
  76. package/dist/dynamic/components/TimePicker/package.json +1 -1
  77. package/dist/dynamic/components/Timestamp/package.json +1 -1
  78. package/dist/dynamic/components/Title/package.json +1 -1
  79. package/dist/dynamic/components/ToggleGroup/package.json +1 -1
  80. package/dist/dynamic/components/Toolbar/package.json +1 -1
  81. package/dist/dynamic/components/Tooltip/package.json +1 -1
  82. package/dist/dynamic/components/TreeView/package.json +1 -1
  83. package/dist/dynamic/components/Truncate/package.json +1 -1
  84. package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
  85. package/dist/dynamic/components/Wizard/package.json +1 -1
  86. package/dist/dynamic/deprecated/components/ApplicationLauncher/package.json +1 -1
  87. package/dist/dynamic/deprecated/components/ContextSelector/package.json +1 -1
  88. package/dist/dynamic/deprecated/components/Dropdown/package.json +1 -1
  89. package/dist/dynamic/deprecated/components/OptionsMenu/package.json +1 -1
  90. package/dist/dynamic/deprecated/components/PageHeader/package.json +1 -1
  91. package/dist/dynamic/deprecated/components/Select/package.json +1 -1
  92. package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
  93. package/dist/dynamic/deprecated/components/package.json +1 -1
  94. package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
  95. package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
  96. package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
  97. package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
  98. package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
  99. package/dist/dynamic/helpers/constants/package.json +1 -1
  100. package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
  101. package/dist/dynamic/helpers/favorites/package.json +1 -1
  102. package/dist/dynamic/helpers/fileUtils/package.json +1 -1
  103. package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
  104. package/dist/dynamic/helpers/package.json +1 -1
  105. package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
  106. package/dist/dynamic/helpers/typeUtils/package.json +1 -1
  107. package/dist/dynamic/helpers/useInterval/package.json +1 -1
  108. package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
  109. package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
  110. package/dist/dynamic/helpers/util/package.json +1 -1
  111. package/dist/dynamic/layouts/Bullseye/package.json +1 -1
  112. package/dist/dynamic/layouts/Flex/package.json +1 -1
  113. package/dist/dynamic/layouts/Gallery/package.json +1 -1
  114. package/dist/dynamic/layouts/Grid/package.json +1 -1
  115. package/dist/dynamic/layouts/Level/package.json +1 -1
  116. package/dist/dynamic/layouts/Split/package.json +1 -1
  117. package/dist/dynamic/layouts/Stack/package.json +1 -1
  118. package/dist/dynamic/next/components/DualListSelector/package.json +1 -1
  119. package/dist/dynamic/next/components/Modal/package.json +1 -1
  120. package/dist/dynamic/next/components/package.json +1 -1
  121. package/dist/dynamic/styles/package.json +1 -1
  122. package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
  123. package/dist/esm/components/DatePicker/DatePicker.js +10 -5
  124. package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
  125. package/dist/esm/components/Wizard/Wizard.d.ts +5 -1
  126. package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -1
  127. package/dist/esm/components/Wizard/Wizard.js +9 -2
  128. package/dist/esm/components/Wizard/Wizard.js.map +1 -1
  129. package/dist/esm/components/Wizard/WizardBody.js +8 -9
  130. package/dist/esm/components/Wizard/WizardBody.js.map +1 -1
  131. package/dist/esm/components/Wizard/WizardContext.d.ts +8 -0
  132. package/dist/esm/components/Wizard/WizardContext.d.ts.map +1 -1
  133. package/dist/esm/components/Wizard/WizardContext.js +4 -2
  134. package/dist/esm/components/Wizard/WizardContext.js.map +1 -1
  135. package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
  136. package/dist/esm/components/Wizard/WizardNavItem.js +10 -17
  137. package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
  138. package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
  139. package/dist/js/components/DatePicker/DatePicker.js +10 -5
  140. package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
  141. package/dist/js/components/Wizard/Wizard.d.ts +5 -1
  142. package/dist/js/components/Wizard/Wizard.d.ts.map +1 -1
  143. package/dist/js/components/Wizard/Wizard.js +9 -2
  144. package/dist/js/components/Wizard/Wizard.js.map +1 -1
  145. package/dist/js/components/Wizard/WizardBody.js +8 -9
  146. package/dist/js/components/Wizard/WizardBody.js.map +1 -1
  147. package/dist/js/components/Wizard/WizardContext.d.ts +8 -0
  148. package/dist/js/components/Wizard/WizardContext.d.ts.map +1 -1
  149. package/dist/js/components/Wizard/WizardContext.js +4 -2
  150. package/dist/js/components/Wizard/WizardContext.js.map +1 -1
  151. package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
  152. package/dist/js/components/Wizard/WizardNavItem.js +10 -17
  153. package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
  154. package/dist/umd/react-core.min.js +1 -1
  155. package/helpers/package.json +1 -1
  156. package/layouts/package.json +1 -1
  157. package/next/package.json +1 -1
  158. package/package.json +2 -2
  159. package/src/components/DatePicker/DatePicker.tsx +11 -5
  160. package/src/components/Wizard/Wizard.tsx +15 -0
  161. package/src/components/Wizard/WizardBody.tsx +9 -9
  162. package/src/components/Wizard/WizardContext.tsx +14 -2
  163. package/src/components/Wizard/WizardNavItem.tsx +7 -21
  164. package/src/components/Wizard/__tests__/Wizard.test.tsx +4 -4
  165. package/src/components/Wizard/examples/Wizard.md +29 -1
  166. package/src/components/Wizard/examples/WizardFocusOnNextBack.tsx +16 -0
  167. package/src/components/Wizard/examples/WizardWithCustomFooter.tsx +3 -3
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.4.0-prerelease.3","private":true}
1
+ {"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"5.4.0-prerelease.5","private":true}
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.4.0-prerelease.3","private":true}
1
+ {"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"5.4.0-prerelease.5","private":true}
package/next/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.4.0-prerelease.3","private":true}
1
+ {"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"5.4.0-prerelease.5","private":true}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "5.4.0-prerelease.4",
3
+ "version": "5.4.0-prerelease.6",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -71,5 +71,5 @@
71
71
  "react": "^17 || ^18",
72
72
  "react-dom": "^17 || ^18"
73
73
  },
74
- "gitHead": "617c9b6e493357752bf044de91bcc03428a9d508"
74
+ "gitHead": "f95fee9045c1016f14280fe27178292098777bca"
75
75
  }
@@ -144,18 +144,24 @@ const DatePickerBase = (
144
144
  setValueDate(dateParse(valueProp));
145
145
  }, [valueProp]);
146
146
 
147
+ React.useEffect(() => {
148
+ if (isValidDate(valueDate)) {
149
+ applyValidators(valueDate);
150
+ }
151
+ }, [validators]);
152
+
147
153
  React.useEffect(() => {
148
154
  setPristine(!value);
149
155
  const newValueDate = dateParse(value);
150
156
  if (errorText && isValidDate(newValueDate)) {
151
- setError(newValueDate);
157
+ applyValidators(newValueDate);
152
158
  }
153
159
  if (value === '' && !pristine && !textInputFocused) {
154
160
  dateIsRequired ? setErrorText(emptyDateText) : setErrorText('');
155
161
  }
156
162
  }, [value]);
157
163
 
158
- const setError = (date: Date) => {
164
+ const applyValidators = (date: Date) => {
159
165
  setErrorText(validators.map((validator) => validator(date)).join('\n') || '');
160
166
  };
161
167
 
@@ -179,7 +185,7 @@ const DatePickerBase = (
179
185
  onBlur(event, value, onBlurDateArg);
180
186
 
181
187
  if (dateIsValid) {
182
- setError(newValueDate);
188
+ applyValidators(newValueDate);
183
189
  }
184
190
 
185
191
  if (!dateIsValid && !pristine) {
@@ -195,7 +201,7 @@ const DatePickerBase = (
195
201
  const newValue = dateFormat(newValueDate);
196
202
  setValue(newValue);
197
203
  setValueDate(newValueDate);
198
- setError(newValueDate);
204
+ applyValidators(newValueDate);
199
205
  setPopoverOpen(false);
200
206
  onChange(null, newValue, new Date(newValueDate));
201
207
  };
@@ -203,7 +209,7 @@ const DatePickerBase = (
203
209
  const onKeyPress = (ev: React.KeyboardEvent<HTMLInputElement>) => {
204
210
  if (ev.key === 'Enter' && value) {
205
211
  if (isValidDate(valueDate)) {
206
- setError(valueDate);
212
+ applyValidators(valueDate);
207
213
  } else {
208
214
  setErrorText(invalidFormatText);
209
215
  }
@@ -55,6 +55,10 @@ export interface WizardProps extends React.HTMLProps<HTMLDivElement> {
55
55
  onSave?: (event: React.MouseEvent<HTMLButtonElement>) => void | Promise<void>;
56
56
  /** Callback function to close the wizard */
57
57
  onClose?: (event: React.MouseEvent<HTMLButtonElement>) => void;
58
+ /** @beta Flag indicating whether the wizard content should be focused after the onNext or onBack callbacks
59
+ * are called.
60
+ */
61
+ shouldFocusContent?: boolean;
58
62
  }
59
63
 
60
64
  export const Wizard = ({
@@ -72,11 +76,13 @@ export const Wizard = ({
72
76
  onStepChange,
73
77
  onSave,
74
78
  onClose,
79
+ shouldFocusContent = false,
75
80
  ...wrapperProps
76
81
  }: WizardProps) => {
77
82
  const [activeStepIndex, setActiveStepIndex] = React.useState(startIndex);
78
83
  const initialSteps = buildSteps(children);
79
84
  const firstStepRef = React.useRef(initialSteps[startIndex - 1]);
85
+ const wrapperRef = React.useRef(null);
80
86
 
81
87
  // When the startIndex maps to a parent step, focus on the first sub-step
82
88
  React.useEffect(() => {
@@ -85,6 +91,11 @@ export const Wizard = ({
85
91
  }
86
92
  }, [startIndex]);
87
93
 
94
+ const focusMainContentElement = () =>
95
+ setTimeout(() => {
96
+ wrapperRef?.current?.focus && wrapperRef.current.focus();
97
+ }, 0);
98
+
88
99
  const goToNextStep = (event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[] = initialSteps) => {
89
100
  const newStep = steps.find((step) => step.index > activeStepIndex && isStepEnabled(steps, step));
90
101
 
@@ -94,6 +105,7 @@ export const Wizard = ({
94
105
 
95
106
  setActiveStepIndex(newStep?.index);
96
107
  onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Next);
108
+ shouldFocusContent && focusMainContentElement();
97
109
  };
98
110
 
99
111
  const goToPrevStep = (event: React.MouseEvent<HTMLButtonElement>, steps: WizardStepType[] = initialSteps) => {
@@ -103,6 +115,7 @@ export const Wizard = ({
103
115
 
104
116
  setActiveStepIndex(newStep?.index);
105
117
  onStepChange?.(event, newStep, steps[activeStepIndex - 1], WizardStepChangeScope.Back);
118
+ shouldFocusContent && focusMainContentElement();
106
119
  };
107
120
 
108
121
  const goToStepByIndex = (
@@ -157,6 +170,8 @@ export const Wizard = ({
157
170
  goToStepById={goToStepById}
158
171
  goToStepByName={goToStepByName}
159
172
  goToStepByIndex={goToStepByIndex}
173
+ shouldFocusContent={shouldFocusContent}
174
+ mainWrapperRef={wrapperRef}
160
175
  >
161
176
  <div
162
177
  className={css(styles.wizard, className)}
@@ -36,15 +36,14 @@ export const WizardBody = ({
36
36
  }: WizardBodyProps) => {
37
37
  const [hasScrollbar, setHasScrollbar] = React.useState(false);
38
38
  const [previousWidth, setPreviousWidth] = React.useState<number | undefined>(undefined);
39
- const wrapperRef = React.useRef(null);
40
39
  const WrapperComponent = component;
41
- const { activeStep } = React.useContext(WizardContext);
40
+ const { activeStep, shouldFocusContent, mainWrapperRef } = React.useContext(WizardContext);
42
41
  const defaultAriaLabel = ariaLabel || `${activeStep?.name} content`;
43
42
 
44
43
  React.useEffect(() => {
45
44
  const resize = () => {
46
- if (wrapperRef?.current) {
47
- const { offsetWidth, offsetHeight, scrollHeight } = wrapperRef.current;
45
+ if (mainWrapperRef?.current) {
46
+ const { offsetWidth, offsetHeight, scrollHeight } = mainWrapperRef.current;
48
47
 
49
48
  if (previousWidth !== offsetWidth) {
50
49
  setPreviousWidth(offsetWidth);
@@ -56,12 +55,12 @@ export const WizardBody = ({
56
55
  const handleResizeWithDelay = debounce(resize, 250);
57
56
  let observer = () => {};
58
57
 
59
- if (wrapperRef?.current) {
60
- observer = getResizeObserver(wrapperRef.current, handleResizeWithDelay);
61
- const { offsetHeight, scrollHeight } = wrapperRef.current;
58
+ if (mainWrapperRef?.current) {
59
+ observer = getResizeObserver(mainWrapperRef.current, handleResizeWithDelay);
60
+ const { offsetHeight, scrollHeight } = mainWrapperRef.current;
62
61
 
63
62
  setHasScrollbar(offsetHeight < scrollHeight);
64
- setPreviousWidth((wrapperRef.current as HTMLElement).offsetWidth);
63
+ setPreviousWidth((mainWrapperRef.current as HTMLElement).offsetWidth);
65
64
  }
66
65
 
67
66
  return () => {
@@ -71,7 +70,8 @@ export const WizardBody = ({
71
70
 
72
71
  return (
73
72
  <WrapperComponent
74
- ref={wrapperRef}
73
+ ref={mainWrapperRef}
74
+ {...(shouldFocusContent && { tabIndex: -1 })}
75
75
  {...(component === 'div' && hasScrollbar && { role: 'region' })}
76
76
  {...(hasScrollbar && { 'aria-label': defaultAriaLabel, 'aria-labelledby': ariaLabelledBy, tabIndex: 0 })}
77
77
  className={css(styles.wizardMain)}
@@ -28,6 +28,12 @@ export interface WizardContextProps {
28
28
  getStep: (stepId: number | string) => WizardStepType;
29
29
  /** Set step by ID */
30
30
  setStep: (step: Pick<WizardStepType, 'id'> & Partial<WizardStepType>) => void;
31
+ /** Flag indicating whether the wizard content should be focused after the onNext or onBack callbacks
32
+ * are called.
33
+ */
34
+ shouldFocusContent: boolean;
35
+ /** Ref for main wizard content element. */
36
+ mainWrapperRef: React.RefObject<HTMLElement>;
31
37
  }
32
38
 
33
39
  export const WizardContext = React.createContext({} as WizardContextProps);
@@ -47,6 +53,8 @@ export interface WizardContextProviderProps {
47
53
  steps: WizardStepType[],
48
54
  index: number
49
55
  ): void;
56
+ shouldFocusContent: boolean;
57
+ mainWrapperRef: React.RefObject<HTMLElement>;
50
58
  }
51
59
 
52
60
  export const WizardContextProvider: React.FunctionComponent<WizardContextProviderProps> = ({
@@ -59,7 +67,9 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
59
67
  onClose,
60
68
  goToStepById,
61
69
  goToStepByName,
62
- goToStepByIndex
70
+ goToStepByIndex,
71
+ shouldFocusContent,
72
+ mainWrapperRef
63
73
  }) => {
64
74
  const [currentSteps, setCurrentSteps] = React.useState<WizardStepType[]>(initialSteps);
65
75
  const [currentFooter, setCurrentFooter] = React.useState<WizardFooterType>();
@@ -139,7 +149,9 @@ export const WizardContextProvider: React.FunctionComponent<WizardContextProvide
139
149
  goToStepByIndex: React.useCallback(
140
150
  (index: number) => goToStepByIndex(null, steps, index),
141
151
  [goToStepByIndex, steps]
142
- )
152
+ ),
153
+ shouldFocusContent,
154
+ mainWrapperRef
143
155
  }}
144
156
  >
145
157
  {children}
@@ -44,6 +44,7 @@ export const WizardNavItem = ({
44
44
  content = '',
45
45
  isCurrent = false,
46
46
  isDisabled = false,
47
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
48
  isVisited = false,
48
49
  stepIndex,
49
50
  onClick,
@@ -68,23 +69,6 @@ export const WizardNavItem = ({
68
69
  console.error('WizardNavItem: When using an anchor, please provide an href');
69
70
  }
70
71
 
71
- const ariaLabel = React.useMemo(() => {
72
- if (status === WizardNavItemStatus.Error || (isVisited && !isCurrent)) {
73
- let label = content.toString();
74
-
75
- if (status === WizardNavItemStatus.Error) {
76
- label += `, ${status}`;
77
- }
78
-
79
- // No need to signify step is visited if current
80
- if (isVisited && !isCurrent) {
81
- label += ', visited';
82
- }
83
-
84
- return label;
85
- }
86
- }, [content, isCurrent, isVisited, status]);
87
-
88
72
  return (
89
73
  <li
90
74
  className={css(
@@ -110,7 +94,6 @@ export const WizardNavItem = ({
110
94
  aria-disabled={isDisabled ? true : null}
111
95
  aria-current={isCurrent && !children ? 'step' : false}
112
96
  {...(isExpandable && { 'aria-expanded': isExpanded })}
113
- {...(ariaLabel && { 'aria-label': ariaLabel })}
114
97
  {...ouiaProps}
115
98
  >
116
99
  {isExpandable ? (
@@ -127,9 +110,12 @@ export const WizardNavItem = ({
127
110
  {content}
128
111
  {/* TODO, patternfly/patternfly#5142 */}
129
112
  {status === WizardNavItemStatus.Error && (
130
- <span style={{ marginLeft: globalSpacerSm.var }}>
131
- <ExclamationCircleIcon color={globalDangerColor100.var} />
132
- </span>
113
+ <>
114
+ <span className="pf-v5-screen-reader">, {status}</span>
115
+ <span style={{ marginLeft: globalSpacerSm.var }}>
116
+ <ExclamationCircleIcon color={globalDangerColor100.var} />
117
+ </span>
118
+ </>
133
119
  )}
134
120
  </>
135
121
  )}
@@ -411,7 +411,7 @@ test('incrementally shows/hides steps based on the activeStep when isProgressive
411
411
  await user.click(nextButton);
412
412
  expect(
413
413
  screen.getByRole('button', {
414
- name: 'Test step 1, visited'
414
+ name: 'Test step 1'
415
415
  })
416
416
  ).toBeVisible();
417
417
  expect(
@@ -429,12 +429,12 @@ test('incrementally shows/hides steps based on the activeStep when isProgressive
429
429
  await user.click(nextButton);
430
430
  expect(
431
431
  screen.getByRole('button', {
432
- name: 'Test step 1, visited'
432
+ name: 'Test step 1'
433
433
  })
434
434
  ).toBeVisible();
435
435
  expect(
436
436
  screen.getByRole('button', {
437
- name: 'Test step 2, visited'
437
+ name: 'Test step 2'
438
438
  })
439
439
  ).toBeVisible();
440
440
  expect(
@@ -447,7 +447,7 @@ test('incrementally shows/hides steps based on the activeStep when isProgressive
447
447
  await user.click(backButton);
448
448
  expect(
449
449
  screen.getByRole('button', {
450
- name: 'Test step 1, visited'
450
+ name: 'Test step 1'
451
451
  })
452
452
  ).toBeVisible();
453
453
  expect(
@@ -16,7 +16,7 @@ propComponents:
16
16
  'WizardContextProps',
17
17
  'WizardBasicStep',
18
18
  'WizardParentStep',
19
- 'WizardSubStep',
19
+ 'WizardSubStep'
20
20
  ]
21
21
  ---
22
22
 
@@ -57,91 +57,119 @@ import layout from '@patternfly/react-styles/css/layouts/Bullseye/bullseye';
57
57
  ### Basic
58
58
 
59
59
  ```ts file="./WizardBasic.tsx"
60
+
61
+ ```
62
+
63
+ ### Focus content on next/back
64
+
65
+ To focus the main content element of the `Wizard`, pass in the `shouldFocusContent` property. It is recommended that this is passed in so that users can navigate through a `WizardStep` content in order.
66
+
67
+ If a `WizardStep` is passed a `body={null}` property, you must manually handle focus.
68
+
69
+ ```ts file="./WizardFocusOnNextBack.tsx"
70
+
60
71
  ```
61
72
 
62
73
  ### Basic with disabled steps
63
74
 
64
75
  ```ts file="./WizardBasicDisabledSteps.tsx"
76
+
65
77
  ```
66
78
 
67
79
  ### Anchors for nav items
68
80
 
69
81
  ```ts file="./WizardWithNavAnchors.tsx"
82
+
70
83
  ```
71
84
 
72
85
  ### Incrementally enabled steps
73
86
 
74
87
  ```ts file="./WizardStepVisitRequired.tsx"
88
+
75
89
  ```
76
90
 
77
91
  ### Expandable steps
78
92
 
79
93
  ```ts file="./WizardExpandableSteps.tsx"
94
+
80
95
  ```
81
96
 
82
97
  ### Progress after submission
83
98
 
84
99
  ```ts file="./WizardWithSubmitProgress.tsx"
100
+
85
101
  ```
86
102
 
87
103
  ### Enabled on form validation
88
104
 
89
105
  ```ts file="./WizardEnabledOnFormValidation.tsx"
106
+
90
107
  ```
91
108
 
92
109
  ### Validate on button press
93
110
 
94
111
  ```ts file="./WizardValidateOnButtonPress.tsx"
112
+
95
113
  ```
96
114
 
97
115
  ### Progressive steps
98
116
 
99
117
  ```ts file="./WizardProgressiveSteps.tsx"
118
+
100
119
  ```
101
120
 
102
121
  ### Get current step
103
122
 
104
123
  ```ts file="./WizardGetCurrentStep.tsx"
124
+
105
125
  ```
106
126
 
107
127
  ### Within modal
108
128
 
109
129
  ```ts file="./WizardWithinModal.tsx"
130
+
110
131
  ```
111
132
 
112
133
  ### Step drawer content
113
134
 
114
135
  ```ts file="./WizardStepDrawerContent.tsx"
136
+
115
137
  ```
116
138
 
117
139
  ### Custom navigation
118
140
 
119
141
  ```ts file="./WizardWithCustomNav.tsx"
142
+
120
143
  ```
121
144
 
122
145
  ### Header
123
146
 
124
147
  ```ts file="./WizardWithHeader.tsx"
148
+
125
149
  ```
126
150
 
127
151
  ### Custom footer
128
152
 
129
153
  ```ts file="./WizardWithCustomFooter.tsx"
154
+
130
155
  ```
131
156
 
132
157
  ### Custom navigation item
133
158
 
134
159
  ```ts file="./WizardWithCustomNavItem.tsx"
160
+
135
161
  ```
136
162
 
137
163
  ### Toggle step visibility
138
164
 
139
165
  ```ts file="./WizardToggleStepVisibility.tsx"
166
+
140
167
  ```
141
168
 
142
169
  ### Step error status
143
170
 
144
171
  ```ts file="./WizardStepErrorStatus.tsx"
172
+
145
173
  ```
146
174
 
147
175
  ## Hooks
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { Wizard, WizardStep } from '@patternfly/react-core';
3
+
4
+ export const WizardFocusOnNextBack: React.FunctionComponent = () => (
5
+ <Wizard shouldFocusContent title="Wizard that focuses content on next or back click">
6
+ <WizardStep name="Step 1" id="wizard-focus-first-step">
7
+ Step 1 content
8
+ </WizardStep>
9
+ <WizardStep name="Step 2" id="wizard-focus-second-step">
10
+ Step 2 content
11
+ </WizardStep>
12
+ <WizardStep name="Review" id="wizard-focus-review-step" footer={{ nextButtonText: 'Finish' }}>
13
+ Review step content
14
+ </WizardStep>
15
+ </Wizard>
16
+ );
@@ -40,12 +40,12 @@ const CustomStepTwoFooter = () => {
40
40
 
41
41
  return (
42
42
  <WizardFooterWrapper>
43
- <Button variant="primary" onClick={onNext} isLoading={isLoading} isDisabled={isLoading}>
44
- Async Next
45
- </Button>
46
43
  <Button variant="secondary" onClick={goToPrevStep} isDisabled={isLoading}>
47
44
  Back
48
45
  </Button>
46
+ <Button variant="primary" onClick={onNext} isLoading={isLoading} isDisabled={isLoading}>
47
+ Async Next
48
+ </Button>
49
49
  <Button variant="link" onClick={close} isDisabled={isLoading}>
50
50
  Cancel
51
51
  </Button>