diff --git a/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadButton.tsx b/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadButton.tsx index ce623864cac..24de44aee0a 100644 --- a/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadButton.tsx +++ b/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadButton.tsx @@ -9,19 +9,26 @@ export interface MultipleFileUploadButtonProps extends React.HTMLProps = ({ className, 'aria-label': ariaLabel, + browseButtonText = "Upload", ...props }: MultipleFileUploadButtonProps) => { + if (!ariaLabel && !browseButtonText) { + // eslint-disable-next-line no-console + console.warn("For accessibility reasons an aria-label should be specified on MultipleFileUploadButton if a browseButtonText isn't"); + } const { open } = React.useContext(MultipleFileUploadContext); return (
); diff --git a/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadMain.tsx b/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadMain.tsx index 3a0ed196dae..daae1aec256 100644 --- a/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadMain.tsx +++ b/packages/react-core/src/components/MultipleFileUpload/MultipleFileUploadMain.tsx @@ -21,6 +21,8 @@ export interface MultipleFileUploadMainProps extends React.HTMLProps = ({ @@ -30,6 +32,7 @@ export const MultipleFileUploadMain: React.FunctionComponent { const showTitle = !!titleIcon || !!titleText || !!titleTextSeparator; @@ -37,7 +40,7 @@ export const MultipleFileUploadMain: React.FunctionComponent {showTitle && } - {isUploadButtonHidden || } + {isUploadButtonHidden || } {!!infoText && {infoText}} ); diff --git a/packages/react-core/src/components/MultipleFileUpload/__tests__/MultipleFileUploadButton.test.tsx b/packages/react-core/src/components/MultipleFileUpload/__tests__/MultipleFileUploadButton.test.tsx index 8da9c11ec60..86f5138fcd5 100644 --- a/packages/react-core/src/components/MultipleFileUpload/__tests__/MultipleFileUploadButton.test.tsx +++ b/packages/react-core/src/components/MultipleFileUpload/__tests__/MultipleFileUploadButton.test.tsx @@ -17,4 +17,9 @@ describe('MultipleFileUploadButton', () => { const { asFragment } = render(Foo); expect(asFragment()).toMatchSnapshot(); }); + + test('renders with label applied to the button', () => { + const { asFragment } = render(Foo); + expect(asFragment()).toMatchSnapshot(); + }); });