@patternfly/react-core 4.232.8 → 4.232.9
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/CHANGELOG.md +8 -0
- package/dist/esm/components/Page/PageBreadcrumb.d.ts +3 -1
- package/dist/esm/components/Page/PageBreadcrumb.d.ts.map +1 -1
- package/dist/esm/components/Page/PageBreadcrumb.js +8 -2
- package/dist/esm/components/Page/PageBreadcrumb.js.map +1 -1
- package/dist/esm/components/Page/PageGroup.d.ts +3 -1
- package/dist/esm/components/Page/PageGroup.d.ts.map +1 -1
- package/dist/esm/components/Page/PageGroup.js +8 -2
- package/dist/esm/components/Page/PageGroup.js.map +1 -1
- package/dist/esm/components/Page/PageNavigation.d.ts +3 -1
- package/dist/esm/components/Page/PageNavigation.d.ts.map +1 -1
- package/dist/esm/components/Page/PageNavigation.js +8 -2
- package/dist/esm/components/Page/PageNavigation.js.map +1 -1
- package/dist/esm/components/Page/PageSection.d.ts +4 -0
- package/dist/esm/components/Page/PageSection.d.ts.map +1 -1
- package/dist/esm/components/Page/PageSection.js +8 -2
- package/dist/esm/components/Page/PageSection.js.map +1 -1
- package/dist/js/components/Page/PageBreadcrumb.d.ts +3 -1
- package/dist/js/components/Page/PageBreadcrumb.d.ts.map +1 -1
- package/dist/js/components/Page/PageBreadcrumb.js +8 -2
- package/dist/js/components/Page/PageBreadcrumb.js.map +1 -1
- package/dist/js/components/Page/PageGroup.d.ts +3 -1
- package/dist/js/components/Page/PageGroup.d.ts.map +1 -1
- package/dist/js/components/Page/PageGroup.js +8 -2
- package/dist/js/components/Page/PageGroup.js.map +1 -1
- package/dist/js/components/Page/PageNavigation.d.ts +3 -1
- package/dist/js/components/Page/PageNavigation.d.ts.map +1 -1
- package/dist/js/components/Page/PageNavigation.js +8 -2
- package/dist/js/components/Page/PageNavigation.js.map +1 -1
- package/dist/js/components/Page/PageSection.d.ts +4 -0
- package/dist/js/components/Page/PageSection.d.ts.map +1 -1
- package/dist/js/components/Page/PageSection.js +8 -2
- package/dist/js/components/Page/PageSection.js.map +1 -1
- package/dist/umd/react-core.js +32 -8
- package/dist/umd/react-core.min.css +106 -106
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +5 -5
- package/src/components/Page/PageBreadcrumb.tsx +11 -0
- package/src/components/Page/PageGroup.tsx +11 -0
- package/src/components/Page/PageNavigation.tsx +11 -0
- package/src/components/Page/PageSection.tsx +13 -0
- package/src/components/Page/__tests__/PageBreadcrumb.test.tsx +41 -1
- package/src/components/Page/__tests__/PageGroup.test.tsx +41 -1
- package/src/components/Page/__tests__/PageNavigation.test.tsx +41 -1
- package/src/components/Page/__tests__/PageSection.test.tsx +41 -1
- package/src/demos/JumpLinks.md +1 -0
- package/src/demos/examples/BackToTop/BackToTopNameDemo.tsx +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.232.
|
|
3
|
+
"version": "4.232.9",
|
|
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",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"generate": "node scripts/copyStyles.js"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@patternfly/react-icons": "^4.83.
|
|
54
|
-
"@patternfly/react-styles": "^4.82.
|
|
55
|
-
"@patternfly/react-tokens": "^4.84.
|
|
53
|
+
"@patternfly/react-icons": "^4.83.9",
|
|
54
|
+
"@patternfly/react-styles": "^4.82.9",
|
|
55
|
+
"@patternfly/react-tokens": "^4.84.9",
|
|
56
56
|
"focus-trap": "6.9.2",
|
|
57
57
|
"react-dropzone": "9.0.0",
|
|
58
58
|
"tippy.js": "5.1.2",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"react": "^16.8.0 || ^17.0.0",
|
|
77
77
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "5dcbfc431138fdca38af2734e31d759b3719dc32"
|
|
80
80
|
}
|
|
@@ -28,6 +28,8 @@ export interface PageBreadcrumbProps extends React.HTMLProps<HTMLElement> {
|
|
|
28
28
|
hasShadowBottom?: boolean;
|
|
29
29
|
/** Flag indicating if the PageBreadcrumb has a scrolling overflow */
|
|
30
30
|
hasOverflowScroll?: boolean;
|
|
31
|
+
/** Adds an accessible name to the breadcrumb section. Required when the hasOverflowScroll prop is set to true. */
|
|
32
|
+
'aria-label'?: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export const PageBreadcrumb = ({
|
|
@@ -39,10 +41,18 @@ export const PageBreadcrumb = ({
|
|
|
39
41
|
hasShadowTop = false,
|
|
40
42
|
hasShadowBottom = false,
|
|
41
43
|
hasOverflowScroll = false,
|
|
44
|
+
'aria-label': ariaLabel,
|
|
42
45
|
...props
|
|
43
46
|
}: PageBreadcrumbProps) => {
|
|
44
47
|
const { height, getVerticalBreakpoint } = React.useContext(PageContext);
|
|
45
48
|
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (hasOverflowScroll && !ariaLabel) {
|
|
51
|
+
/* eslint-disable no-console */
|
|
52
|
+
console.warn('PageBreadcrumb: An accessible aria-label is required when hasOverflowScroll is set to true.');
|
|
53
|
+
}
|
|
54
|
+
}, [hasOverflowScroll, ariaLabel]);
|
|
55
|
+
|
|
46
56
|
return (
|
|
47
57
|
<section
|
|
48
58
|
className={css(
|
|
@@ -57,6 +67,7 @@ export const PageBreadcrumb = ({
|
|
|
57
67
|
className
|
|
58
68
|
)}
|
|
59
69
|
{...(hasOverflowScroll && { tabIndex: 0 })}
|
|
70
|
+
aria-label={ariaLabel}
|
|
60
71
|
{...props}
|
|
61
72
|
>
|
|
62
73
|
{isWidthLimited && <div className={css(styles.pageMainBody)}>{children}</div>}
|
|
@@ -25,6 +25,8 @@ export interface PageGroupProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
25
25
|
hasShadowBottom?: boolean;
|
|
26
26
|
/** Flag indicating if the PageGroup has a scrolling overflow */
|
|
27
27
|
hasOverflowScroll?: boolean;
|
|
28
|
+
/** Adds an accessible name to the page group. Required when the hasOverflowScroll prop is set to true. */
|
|
29
|
+
'aria-label'?: string;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export const PageGroup = ({
|
|
@@ -35,10 +37,18 @@ export const PageGroup = ({
|
|
|
35
37
|
hasShadowTop = false,
|
|
36
38
|
hasShadowBottom = false,
|
|
37
39
|
hasOverflowScroll = false,
|
|
40
|
+
'aria-label': ariaLabel,
|
|
38
41
|
...props
|
|
39
42
|
}: PageGroupProps) => {
|
|
40
43
|
const { height, getVerticalBreakpoint } = React.useContext(PageContext);
|
|
41
44
|
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
if (hasOverflowScroll && !ariaLabel) {
|
|
47
|
+
/* eslint-disable no-console */
|
|
48
|
+
console.warn('PageGroup: An accessible aria-label is required when hasOverflowScroll is set to true.');
|
|
49
|
+
}
|
|
50
|
+
}, [hasOverflowScroll, ariaLabel]);
|
|
51
|
+
|
|
42
52
|
return (
|
|
43
53
|
<div
|
|
44
54
|
{...props}
|
|
@@ -53,6 +63,7 @@ export const PageGroup = ({
|
|
|
53
63
|
className
|
|
54
64
|
)}
|
|
55
65
|
{...(hasOverflowScroll && { tabIndex: 0 })}
|
|
66
|
+
aria-label={ariaLabel}
|
|
56
67
|
>
|
|
57
68
|
{children}
|
|
58
69
|
</div>
|
|
@@ -28,6 +28,8 @@ export interface PageNavigationProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
28
28
|
hasShadowBottom?: boolean;
|
|
29
29
|
/** Flag indicating if the PageNavigation has a scrolling overflow */
|
|
30
30
|
hasOverflowScroll?: boolean;
|
|
31
|
+
/** Adds an accessible name to the page navigation. Required when the hasOverflowScroll prop is set to true. */
|
|
32
|
+
'aria-label'?: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export const PageNavigation = ({
|
|
@@ -39,10 +41,18 @@ export const PageNavigation = ({
|
|
|
39
41
|
hasShadowTop = false,
|
|
40
42
|
hasShadowBottom = false,
|
|
41
43
|
hasOverflowScroll = false,
|
|
44
|
+
'aria-label': ariaLabel,
|
|
42
45
|
...props
|
|
43
46
|
}: PageNavigationProps) => {
|
|
44
47
|
const { height, getVerticalBreakpoint } = React.useContext(PageContext);
|
|
45
48
|
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (hasOverflowScroll && !ariaLabel) {
|
|
51
|
+
/* eslint-disable no-console */
|
|
52
|
+
console.warn('PageNavigation: An accessible aria-label is required when hasOverflowScroll is set to true.');
|
|
53
|
+
}
|
|
54
|
+
}, [hasOverflowScroll, ariaLabel]);
|
|
55
|
+
|
|
46
56
|
return (
|
|
47
57
|
<div
|
|
48
58
|
className={css(
|
|
@@ -57,6 +67,7 @@ export const PageNavigation = ({
|
|
|
57
67
|
className
|
|
58
68
|
)}
|
|
59
69
|
{...(hasOverflowScroll && { tabIndex: 0 })}
|
|
70
|
+
aria-label={ariaLabel}
|
|
60
71
|
{...props}
|
|
61
72
|
>
|
|
62
73
|
{isWidthLimited && <div className={css(styles.pageMainBody)}>{children}</div>}
|
|
@@ -61,6 +61,10 @@ export interface PageSectionProps extends React.HTMLProps<HTMLDivElement> {
|
|
|
61
61
|
hasShadowBottom?: boolean;
|
|
62
62
|
/** Flag indicating if the PageSection has a scrolling overflow */
|
|
63
63
|
hasOverflowScroll?: boolean;
|
|
64
|
+
/** Adds an accessible name to the page section. Required when the hasOverflowScroll prop is set to true.
|
|
65
|
+
* This prop should also be passed in if a heading is not being used to describe the content of the page section.
|
|
66
|
+
*/
|
|
67
|
+
'aria-label'?: string;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
const variantType = {
|
|
@@ -93,10 +97,18 @@ export const PageSection: React.FunctionComponent<PageSectionProps> = ({
|
|
|
93
97
|
hasShadowTop = false,
|
|
94
98
|
hasShadowBottom = false,
|
|
95
99
|
hasOverflowScroll = false,
|
|
100
|
+
'aria-label': ariaLabel,
|
|
96
101
|
...props
|
|
97
102
|
}: PageSectionProps) => {
|
|
98
103
|
const { height, getVerticalBreakpoint } = React.useContext(PageContext);
|
|
99
104
|
|
|
105
|
+
React.useEffect(() => {
|
|
106
|
+
if (hasOverflowScroll && !ariaLabel) {
|
|
107
|
+
/* eslint-disable no-console */
|
|
108
|
+
console.warn('PageSection: An accessible aria-label is required when hasOverflowScroll is set to true.');
|
|
109
|
+
}
|
|
110
|
+
}, [hasOverflowScroll, ariaLabel]);
|
|
111
|
+
|
|
100
112
|
return (
|
|
101
113
|
<section
|
|
102
114
|
{...props}
|
|
@@ -117,6 +129,7 @@ export const PageSection: React.FunctionComponent<PageSectionProps> = ({
|
|
|
117
129
|
className
|
|
118
130
|
)}
|
|
119
131
|
{...(hasOverflowScroll && { tabIndex: 0 })}
|
|
132
|
+
aria-label={ariaLabel}
|
|
120
133
|
>
|
|
121
134
|
{isWidthLimited && <div className={css(styles.pageMainBody)}>{children}</div>}
|
|
122
135
|
{!isWidthLimited && children}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { PageBreadcrumb } from '../PageBreadcrumb';
|
|
4
4
|
|
|
5
5
|
describe('page breadcrumb', () => {
|
|
@@ -31,4 +31,44 @@ describe('page breadcrumb', () => {
|
|
|
31
31
|
const { asFragment } = render(<PageBreadcrumb hasOverflowScroll>test</PageBreadcrumb>);
|
|
32
32
|
expect(asFragment()).toMatchSnapshot();
|
|
33
33
|
});
|
|
34
|
+
|
|
35
|
+
test('Renders without an aria-label by default', () => {
|
|
36
|
+
render(<PageBreadcrumb>test</PageBreadcrumb>);
|
|
37
|
+
|
|
38
|
+
expect(screen.getByText('test')).not.toHaveAccessibleName('Test label');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('Renders with the passed aria-label applied', () => {
|
|
42
|
+
render(<PageBreadcrumb aria-label="Test label">test</PageBreadcrumb>);
|
|
43
|
+
|
|
44
|
+
expect(screen.getByText('test')).toHaveAccessibleName('Test label');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('Does not log a warning in the console by default', () => {
|
|
48
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
49
|
+
|
|
50
|
+
render(<PageBreadcrumb>test</PageBreadcrumb>);
|
|
51
|
+
|
|
52
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('Does not log a warning in the console when an aria-label is included with hasOverflowScroll', () => {
|
|
56
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
57
|
+
|
|
58
|
+
render(
|
|
59
|
+
<PageBreadcrumb hasOverflowScroll aria-label="Test label">
|
|
60
|
+
test
|
|
61
|
+
</PageBreadcrumb>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('Logs a warning in the console when an aria-label is not included with hasOverflowScroll', () => {
|
|
68
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
69
|
+
|
|
70
|
+
render(<PageBreadcrumb hasOverflowScroll>test</PageBreadcrumb>);
|
|
71
|
+
|
|
72
|
+
expect(consoleWarning).toHaveBeenCalled();
|
|
73
|
+
});
|
|
34
74
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { PageGroup } from '../PageGroup';
|
|
4
4
|
|
|
5
5
|
describe('page group', () => {
|
|
@@ -27,4 +27,44 @@ describe('page group', () => {
|
|
|
27
27
|
const { asFragment } = render(<PageGroup hasOverflowScroll>test</PageGroup>);
|
|
28
28
|
expect(asFragment()).toMatchSnapshot();
|
|
29
29
|
});
|
|
30
|
+
|
|
31
|
+
test('Renders without an aria-label by default', () => {
|
|
32
|
+
render(<PageGroup>test</PageGroup>);
|
|
33
|
+
|
|
34
|
+
expect(screen.getByText('test')).not.toHaveAccessibleName('Test label');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
test('Renders with the passed aria-label applied', () => {
|
|
38
|
+
render(<PageGroup aria-label="Test label">test</PageGroup>);
|
|
39
|
+
|
|
40
|
+
expect(screen.getByText('test')).toHaveAccessibleName('Test label');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test('Does not log a warning in the console by default', () => {
|
|
44
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
45
|
+
|
|
46
|
+
render(<PageGroup>test</PageGroup>);
|
|
47
|
+
|
|
48
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
test('Does not log a warning in the console when an aria-label is included with hasOverflowScroll', () => {
|
|
52
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
53
|
+
|
|
54
|
+
render(
|
|
55
|
+
<PageGroup hasOverflowScroll aria-label="Test label">
|
|
56
|
+
test
|
|
57
|
+
</PageGroup>
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
test('Logs a warning in the console when an aria-label is not included with hasOverflowScroll', () => {
|
|
64
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
65
|
+
|
|
66
|
+
render(<PageGroup hasOverflowScroll>test</PageGroup>);
|
|
67
|
+
|
|
68
|
+
expect(consoleWarning).toHaveBeenCalled();
|
|
69
|
+
});
|
|
30
70
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { PageNavigation } from '../PageNavigation';
|
|
4
4
|
|
|
5
5
|
describe('page navigation', () => {
|
|
@@ -31,4 +31,44 @@ describe('page navigation', () => {
|
|
|
31
31
|
const { asFragment } = render(<PageNavigation hasOverflowScroll>test</PageNavigation>);
|
|
32
32
|
expect(asFragment()).toMatchSnapshot();
|
|
33
33
|
});
|
|
34
|
+
|
|
35
|
+
test('Renders without an aria-label by default', () => {
|
|
36
|
+
render(<PageNavigation>test</PageNavigation>);
|
|
37
|
+
|
|
38
|
+
expect(screen.getByText('test')).not.toHaveAccessibleName('Test label');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('Renders with the passed aria-label applied', () => {
|
|
42
|
+
render(<PageNavigation aria-label="Test label">test</PageNavigation>);
|
|
43
|
+
|
|
44
|
+
expect(screen.getByText('test')).toHaveAccessibleName('Test label');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('Does not log a warning in the console by default', () => {
|
|
48
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
49
|
+
|
|
50
|
+
render(<PageNavigation>test</PageNavigation>);
|
|
51
|
+
|
|
52
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('Does not log a warning in the console when an aria-label is included with hasOverflowScroll', () => {
|
|
56
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
57
|
+
|
|
58
|
+
render(
|
|
59
|
+
<PageNavigation hasOverflowScroll aria-label="Test label">
|
|
60
|
+
test
|
|
61
|
+
</PageNavigation>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('Logs a warning in the console when an aria-label is not included with hasOverflowScroll', () => {
|
|
68
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
69
|
+
|
|
70
|
+
render(<PageNavigation hasOverflowScroll>test</PageNavigation>);
|
|
71
|
+
|
|
72
|
+
expect(consoleWarning).toHaveBeenCalled();
|
|
73
|
+
});
|
|
34
74
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { PageSection, PageSectionTypes } from '../PageSection';
|
|
4
4
|
|
|
5
5
|
jest.mock('../Page');
|
|
@@ -88,3 +88,43 @@ test('Verify page section overflow scroll', () => {
|
|
|
88
88
|
const { asFragment } = render(<PageSection hasOverflowScroll>test</PageSection>);
|
|
89
89
|
expect(asFragment()).toMatchSnapshot();
|
|
90
90
|
});
|
|
91
|
+
|
|
92
|
+
test('Renders without an aria-label by default', () => {
|
|
93
|
+
render(<PageSection>test</PageSection>);
|
|
94
|
+
|
|
95
|
+
expect(screen.getByText('test')).not.toHaveAccessibleName('Test label');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('Renders with the passed aria-label applied', () => {
|
|
99
|
+
render(<PageSection aria-label="Test label">test</PageSection>);
|
|
100
|
+
|
|
101
|
+
expect(screen.getByText('test')).toHaveAccessibleName('Test label');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
test('Does not log a warning in the console by default', () => {
|
|
105
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
106
|
+
|
|
107
|
+
render(<PageSection>test</PageSection>);
|
|
108
|
+
|
|
109
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('Does not log a warning in the console when an aria-label is included with hasOverflowScroll', () => {
|
|
113
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
114
|
+
|
|
115
|
+
render(
|
|
116
|
+
<PageSection hasOverflowScroll aria-label="Test label">
|
|
117
|
+
test
|
|
118
|
+
</PageSection>
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
expect(consoleWarning).not.toHaveBeenCalled();
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
test('Logs a warning in the console when an aria-label is not included with hasOverflowScroll', () => {
|
|
125
|
+
const consoleWarning = jest.spyOn(console, 'warn').mockImplementation();
|
|
126
|
+
|
|
127
|
+
render(<PageSection hasOverflowScroll>test</PageSection>);
|
|
128
|
+
|
|
129
|
+
expect(consoleWarning).toHaveBeenCalled();
|
|
130
|
+
});
|
package/src/demos/JumpLinks.md
CHANGED
|
@@ -10,6 +10,7 @@ import DashboardWrapper from './examples/DashboardWrapper';
|
|
|
10
10
|
JumpLinks has a scrollspy built-in to make your implementation easier. When implementing JumpLinks be sure to:
|
|
11
11
|
|
|
12
12
|
1. Find the correct `scrollableSelector` for your page via [Firefox's debugging scrollable overflow](https://developer.mozilla.org/en-US/docs/Tools/Page_Inspector/How_to/Debug_Scrollable_Overflow) or by adding `hasOverflowScroll` to a [PageSection](/components/page#pagesection) or [PageGroup](/components/page#pagegroup).
|
|
13
|
+
- If you add `hasOverflowScroll` to a Page sub-component you should also add a relevant aria-label to that component as well.
|
|
13
14
|
2. Provide `href`s to your JumpLinksItems which match the `id` of elements you want to spy on. If you wish to scroll to a different item than you're linking to use the `node` prop.
|
|
14
15
|
|
|
15
16
|
### Scrollspy with subsections
|
|
@@ -34,7 +34,12 @@ export const Name = () => {
|
|
|
34
34
|
<Switch label="Always show BackToTopButton" onChange={handleChange} isChecked={isAlwaysVisible} />
|
|
35
35
|
</TextContent>
|
|
36
36
|
</PageSection>
|
|
37
|
-
<PageSection
|
|
37
|
+
<PageSection
|
|
38
|
+
hasOverflowScroll
|
|
39
|
+
name="scrolling-section"
|
|
40
|
+
tabIndex={0}
|
|
41
|
+
aria-label="Scrollable container of demonstration cards with a back to top element"
|
|
42
|
+
>
|
|
38
43
|
<Gallery hasGutter>
|
|
39
44
|
{Array.apply(0, Array(60)).map((_x: any, i: number) => (
|
|
40
45
|
<GalleryItem key={i}>
|