@patternfly/react-core 4.228.0 → 4.228.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.228.0",
3
+ "version": "4.228.1",
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",
@@ -34,9 +34,9 @@
34
34
  "generate": "node scripts/copyStyles.js"
35
35
  },
36
36
  "dependencies": {
37
- "@patternfly/react-icons": "^4.79.0",
38
- "@patternfly/react-styles": "^4.78.0",
39
- "@patternfly/react-tokens": "^4.80.0",
37
+ "@patternfly/react-icons": "^4.79.1",
38
+ "@patternfly/react-styles": "^4.78.1",
39
+ "@patternfly/react-tokens": "^4.80.1",
40
40
  "focus-trap": "6.9.2",
41
41
  "react-dropzone": "9.0.0",
42
42
  "tippy.js": "5.1.2",
@@ -60,5 +60,5 @@
60
60
  "react": "^16.8.0 || ^17.0.0",
61
61
  "react-dom": "^16.8.0 || ^17.0.0"
62
62
  },
63
- "gitHead": "f02b0e0e72ea0aa326e1d512b1da0397b10e7f9a"
63
+ "gitHead": "f6c791bad9fa1bc817102fea17d5ba7243cd6121"
64
64
  }
@@ -192,11 +192,12 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
192
192
  }
193
193
  }, [flyoutVisible, flyoutTarget]);
194
194
 
195
- const handleFlyout = (event: React.KeyboardEvent) => {
196
- const key = event.key;
195
+ const handleFlyout = (event: React.KeyboardEvent | React.MouseEvent) => {
196
+ const key = (event as React.KeyboardEvent).key;
197
197
  const target = event.target;
198
+ const type = event.type;
198
199
 
199
- if (key === ' ' || key === 'Enter' || key === 'ArrowRight') {
200
+ if (key === ' ' || key === 'Enter' || key === 'ArrowRight' || type === 'click') {
200
201
  event.stopPropagation();
201
202
  if (!flyoutVisible) {
202
203
  showFlyout(true);
@@ -251,7 +252,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
251
252
  if (isOnPath) {
252
253
  additionalProps['aria-expanded'] = true;
253
254
  } else if (hasFlyout) {
254
- additionalProps['aria-haspopup'] = true;
255
+ additionalProps['aria-haspopup'] = 'menu';
255
256
  additionalProps['aria-expanded'] = flyoutVisible;
256
257
  }
257
258
  const getAriaCurrent = () => {
@@ -309,12 +310,13 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
309
310
  className={css(styles.menuItem, getIsSelected() && !hasCheck && styles.modifiers.selected, className)}
310
311
  aria-current={getAriaCurrent()}
311
312
  {...(!hasCheck && { disabled: isDisabled })}
312
- {...(!hasCheck && { role: 'menuitem' })}
313
+ {...(!hasCheck && !flyoutMenu && { role: 'menuitem' })}
313
314
  ref={innerRef}
314
315
  {...(!hasCheck && {
315
316
  onClick: (event: any) => {
316
317
  onItemSelect(event, onSelect);
317
318
  _drill && _drill();
319
+ flyoutMenu && handleFlyout(event);
318
320
  }
319
321
  })}
320
322
  {...(hasCheck && { htmlFor: randomId })}
@@ -150,6 +150,11 @@ export const NavItem: React.FunctionComponent<NavItemProps> = ({
150
150
  </span>
151
151
  );
152
152
 
153
+ const ariaFlyoutProps = {
154
+ 'aria-haspopup': 'menu',
155
+ 'aria-expanded': flyoutVisible
156
+ };
157
+
153
158
  const renderDefaultLink = (context: any): React.ReactNode => {
154
159
  const preventLinkDefault = preventDefault || !to;
155
160
  return (
@@ -164,6 +169,7 @@ export const NavItem: React.FunctionComponent<NavItemProps> = ({
164
169
  )}
165
170
  aria-current={isActive ? 'page' : null}
166
171
  tabIndex={isNavOpen ? null : '-1'}
172
+ {...(hasFlyout && { ...ariaFlyoutProps })}
167
173
  {...props}
168
174
  >
169
175
  {children}