FileUploaderDropContainer has nested interactive controls (WCAG "MUST") #8847
Labels
component: file-uploader
package: react
carbon-components-react
severity: 1
https://ibm.biz/carbon-severity
type: a11y ♿
This issue relates to an accessibility violation flagged up by the
axe-core
automated testing tools which Carbon uses in its integrated testing. This violation may not have shown up in that testing yet, for two reasons:axe-core
, v4.1.1. The violation is shown by any version from v4.2.0 onwards (published six weeks ago).However, users of Carbon may already be seeing this violation any time they use the FileUploaderDropContainer. For example, the @carbon/ibm-cloud-cognitive team has seen this violation in our
ImportModal
component which uses FileUploaderDropContainer.Environment
OSX (this is not relevant to the issue as far as I know)
n/A
axe-core
, using jest tests (see steps to reproduce below)n/A
Detailed description
carbon-components-react
v7.36.0 (but there has not been a recent change relevant to this issue)Expected generated DOM to pass automated accessibility tests.
Generated DOM includes the following fragment:
This encloses an
<input>
within a<div>
with role "button". This causes accessibility test failure.4.1.2
See https://dequeuniversity.com/rules/axe/4.2/nested-interactive
Steps to reproduce the issue
carbon-design-system/carbon
repoFileUploaderDropContainer
So unfortunately there currently is not an automated accessibility test included in the jest tests for
FileUploaderDropContainer
. It might be a good idea to add this test in! It can be done quickly to reproduce this issue by inserting the following lines intopackages/react/src/components/FileUploader/__tests__/FileUploaderDropContainer-test.js
somewhere inside the maindescribe()
block, for example at about line 17:This picture shows the completed edit in place:
axe-core
to 4.2.0 or later.The testing for this violation was introduced in
axe-core
v4.2.0, published on April 26 2021. The latest version ofaxe-core
is v4.2.2, published on June 3 2021. The fileconfig/jest-config-carbon/package.json
currently requests v4.1.1 or up ("^4.1.1"), but versions prior to 4.2.0 will not show the violation.This picture shows the above file edited to require at least v4.2.0:
yarn
to ensure all dependencies are fetched.yarn test
.Actually, for speed, it's quicker just to run
yarn jest fileuploaderdrop
. The following picture shows the output from this run if the steps above have been followed:The text was updated successfully, but these errors were encountered: