@patternfly/react-core 4.268.0 → 4.268.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.268.0",
3
+ "version": "4.268.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",
@@ -71,5 +71,5 @@
71
71
  "react": "^16.8 || ^17 || ^18",
72
72
  "react-dom": "^16.8 || ^17 || ^18"
73
73
  },
74
- "gitHead": "4464f97977ce3984b4e589711f26993f1f64a23f"
74
+ "gitHead": "a4fca9d0be55199414a01de809cc041561207489"
75
75
  }
@@ -16,6 +16,8 @@ export interface SimpleListProps extends Omit<React.HTMLProps<HTMLDivElement>, '
16
16
  ) => void;
17
17
  /** Indicates whether component is controlled by its internal state */
18
18
  isControlled?: boolean;
19
+ /** aria-label for the <ul> element that wraps the SimpleList items. */
20
+ 'aria-label'?: string;
19
21
  }
20
22
 
21
23
  export interface SimpleListState {
@@ -57,7 +59,7 @@ export class SimpleList extends React.Component<SimpleListProps, SimpleListState
57
59
 
58
60
  render() {
59
61
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
60
- const { children, className, onSelect, isControlled, ...props } = this.props;
62
+ const { children, className, onSelect, isControlled, 'aria-label': ariaLabel, ...props } = this.props;
61
63
 
62
64
  let isGrouped = false;
63
65
  if (children) {
@@ -74,7 +76,7 @@ export class SimpleList extends React.Component<SimpleListProps, SimpleListState
74
76
  >
75
77
  <div className={css(styles.simpleList, className)} {...props}>
76
78
  {isGrouped && children}
77
- {!isGrouped && <ul>{children}</ul>}
79
+ {!isGrouped && <ul aria-label={ariaLabel}>{children}</ul>}
78
80
  </div>
79
81
  </SimpleListContext.Provider>
80
82
  );
@@ -31,6 +31,11 @@ describe('SimpleList', () => {
31
31
  expect(asFragment()).toMatchSnapshot();
32
32
  });
33
33
 
34
+ test('renders aria-labelled content', () => {
35
+ const { asFragment } = render(<SimpleList aria-label="This is a simple list">{items}</SimpleList>);
36
+ expect(asFragment()).toMatchSnapshot();
37
+ });
38
+
34
39
  test('renders grouped content', () => {
35
40
  const { asFragment } = render(
36
41
  <SimpleList>
@@ -1,5 +1,48 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
+ exports[`SimpleList renders aria-labelled content 1`] = `
4
+ <DocumentFragment>
5
+ <div
6
+ class="pf-c-simple-list"
7
+ >
8
+ <ul
9
+ aria-label="This is a simple list"
10
+ >
11
+ <li
12
+ class=""
13
+ >
14
+ <button
15
+ class="pf-c-simple-list__item-link"
16
+ type="button"
17
+ >
18
+ Item 1
19
+ </button>
20
+ </li>
21
+ <li
22
+ class=""
23
+ >
24
+ <button
25
+ class="pf-c-simple-list__item-link"
26
+ type="button"
27
+ >
28
+ Item 2
29
+ </button>
30
+ </li>
31
+ <li
32
+ class=""
33
+ >
34
+ <button
35
+ class="pf-c-simple-list__item-link"
36
+ type="button"
37
+ >
38
+ Item 3
39
+ </button>
40
+ </li>
41
+ </ul>
42
+ </div>
43
+ </DocumentFragment>
44
+ `;
45
+
3
46
  exports[`SimpleList renders content 1`] = `
4
47
  <DocumentFragment>
5
48
  <div