Commit 7b058c6
authored
fix(a11y): reduce jsx-a11y warnings — common 18→4, studio 45→20 (#446)
* fix(a11y): reduce jsx-a11y warnings common 18→8, studio 45→31 (#386)
- Replace role="button" divs/spans with native <button> elements
- Fix form label associations with aria-labelledby pattern
- Add keyboard event handlers where missing
- Wrap emojis with proper ARIA in test files
- Remove redundant role="form" on native form element
- Add aria-hidden + tabIndex=-1 on decorative canvas
- Create update-max-warnings-a11y.ts script for maintaining baselines
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix(a11y): further reduce warnings common 8→6, studio 31→24
- Replace div role="button" with native button in ReportTraceModal
- Replace Anchor role="button" with Button in FilesetFilePreviewLink
- Add aria-label to hidden file input in AddToolForm
- Add aria-label to mock textarea in DatasetSchemaEditor test
- Remove role="menu" from ul in mockStudioDataView
- Simplify FilesTable quick actions wrapper
- Remove span role="img" from emoji test data
- Remove event handlers from mock table in StudioDataView test
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix: resolve nested button and checkbox label association
- ReportTraceModal: restructure trace card to use sibling button + copy
button instead of nested <button> inside <button>
- AdvancedParameters: restore click-to-toggle on checkbox labels by using
htmlFor/id association instead of aria-labelledby
Signed-off-by: mschwab <mschwab@nvidia.com>
* revert: restore aria-labelledby for checkboxes to satisfy label-has-for
The htmlFor/label form triggers the deprecated jsx-a11y/label-has-for rule
(requires both nesting AND id), pushing warnings to 26 > 24 ceiling.
Revert to aria-labelledby+span which satisfies label-has-associated-control
without firing label-has-for. Trade-off: clicking label text doesn't toggle.
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix: address remaining a11y review nits
- SimpleFilesTable: replace document.getElementById with useRef on file input
- FileTag: gate focusable <button> when onNoFileClick is undefined
- update-max-warnings-a11y.ts: use bare eslint command, guard stdout before parse
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix: align SimpleFilesTable tests with ref-based file input
- Match aria-label casing: 'Upload More Files' → 'Upload more files'
- Remove id assertion (input now uses useRef, no id attribute)
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix(a11y): repair unit tests broken by role/handler changes
The a11y refactors (role=button→button, role=img→aria-hidden, role=form
removal, label→ref upload input) left 13 unit tests asserting roles and
handlers that no longer exist. Realign them with the refactored markup:
- StudioDataView.test: mock TableContent attaches the row-click delegation
handler via a ref callback (native onclick) instead of a JSX onClick prop,
so cell/sub-row click tests pass without re-tripping jsx-a11y on the
test-only <table>; keyboard tests use userEvent (native <button> activates
on Enter/Space, which fireEvent.keyDown does not simulate); link query
matches the renamed 'View' text.
- StatusBadge.test: query the decorative icon by its lucide class instead of
getByRole('img') (icon is now aria-hidden).
- NewCustomizationForm: give the <form> an accessible name so it exposes a
form role again; restores getByRole('form') in create-a-customization.test.
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix(a11y): drop deprecated rules, convert article role, lower ceilings
- eslint.config.a11y.js: enable only non-deprecated jsx-a11y rules (filter
meta.deprecated). accessible-emoji and no-onchange are deprecated by
jsx-a11y 6.10.2 (latest) and produce false positives; excluding them is
the version-aware fix.
- IntakeAnnotationsPanel: <div role="article"> -> <article>.
- CustomFilesetForm: remove autoFocus on the page-load name field
(non-modal autofocus).
- Ratchet lint:a11y ceilings: common 6->4, studio 24->20.
Remaining warnings are intentional modal autofocus and legitimate ARIA on
custom widgets (listbox/option/dialog/separator), where converting to native
tags would regress behavior.
Signed-off-by: mschwab <mschwab@nvidia.com>
* chore(a11y): trim verbose comments
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix(a11y): use KUI Button instead of native button for clickable regions
Wrapping content in a raw <button> bypasses KUI's focus/styling tokens.
Use the KUI Button primitive instead:
- ReportTraceModal: trace-card clickable -> <Button kind=tertiary> (copy
button stays a sibling, no nesting).
- FileTag: no-file clickable -> <Button kind=tertiary>.
Signed-off-by: mschwab <mschwab@nvidia.com>
* test(a11y): assert visible label instead of decorative icon in StatusBadge
The status icon is now aria-hidden (decorative), so querying it requires a
brittle .lucide class selector. Drop those icon-presence assertions and rely
on the visible badge label, which is the user-meaningful output.
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix(a11y): address codex/coderabbit review nits
- update-max-warnings-a11y.ts: fail fast when the lint:a11y script has no
--max-warnings flag, instead of silently no-op'ing while logging 'updated'.
- SimpleFilesTable: tabIndex={-1} on the sr-only file input so keyboard users
don't hit an invisible duplicate upload control (the button triggers it via
ref).
Signed-off-by: mschwab <mschwab@nvidia.com>
* refactor(a11y): use ESLint Node API in update-max-warnings script
Replace the execSync('eslint ... --format json') subprocess + JSON parse +
catch-nonzero-exit handling with the ESLint class API (overrideConfigFile +
allowInlineConfig:false + lintFiles). Reads warningCount off the result
objects directly.
Signed-off-by: mschwab <mschwab@nvidia.com>
* chore(a11y): trim comment in update-max-warnings script
Signed-off-by: mschwab <mschwab@nvidia.com>
* chore(studio): remove unused FilesTable component
FilesTable/index.tsx had no importers (the directory's siblings -
FileQuickActions, DirectoryQuickActions, the file modals, utils - are
imported directly by FilesetFileExplorer/FileActions and stay).
Signed-off-by: mschwab <mschwab@nvidia.com>
* fix(a11y): guard missing scripts object in update-max-warnings script
Make pkg.scripts optional and guard before indexing lint:a11y, so a
package.json without a scripts object hits the explicit error path instead of
throwing a TypeError.
Signed-off-by: mschwab <mschwab@nvidia.com>
---------
Signed-off-by: mschwab <mschwab@nvidia.com>1 parent f7d79d0 commit 7b058c6
23 files changed
Lines changed: 188 additions & 258 deletions
File tree
- web
- packages
- common
- scripts
- src/components
- DataView
- Nebula
- StatusBadge
- UploadModal
- studio
- src
- components
- FileTag
- FilesTable
- NewCustomizationForm
- PromptTuningForm/ToolsSection/components
- ReportTraceModal
- SafeSynthesizerFilesetPreview
- routes
- FilesetDetailRoute/DatasetSchemaEditor
- FilesetNewRoute
- SafeSynthesizerNewRoute/components
- tests
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
Lines changed: 24 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
157 | 158 | | |
158 | 159 | | |
159 | 160 | | |
160 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
161 | 170 | | |
162 | 171 | | |
163 | 172 | | |
| |||
168 | 177 | | |
169 | 178 | | |
170 | 179 | | |
171 | | - | |
| 180 | + | |
172 | 181 | | |
173 | 182 | | |
174 | 183 | | |
| |||
289 | 298 | | |
290 | 299 | | |
291 | 300 | | |
292 | | - | |
| 301 | + | |
293 | 302 | | |
294 | 303 | | |
295 | 304 | | |
| |||
337 | 346 | | |
338 | 347 | | |
339 | 348 | | |
340 | | - | |
| 349 | + | |
| 350 | + | |
341 | 351 | | |
342 | 352 | | |
343 | 353 | | |
344 | 354 | | |
345 | | - | |
| 355 | + | |
| 356 | + | |
346 | 357 | | |
347 | 358 | | |
348 | 359 | | |
349 | 360 | | |
350 | | - | |
| 361 | + | |
| 362 | + | |
351 | 363 | | |
352 | 364 | | |
353 | 365 | | |
354 | 366 | | |
355 | | - | |
| 367 | + | |
| 368 | + | |
356 | 369 | | |
357 | 370 | | |
358 | 371 | | |
| |||
465 | 478 | | |
466 | 479 | | |
467 | 480 | | |
468 | | - | |
| 481 | + | |
| 482 | + | |
469 | 483 | | |
470 | 484 | | |
471 | 485 | | |
472 | 486 | | |
473 | | - | |
| 487 | + | |
| 488 | + | |
474 | 489 | | |
475 | 490 | | |
476 | 491 | | |
| |||
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
76 | 77 | | |
77 | | - | |
78 | | - | |
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 82 | + | |
89 | 83 | | |
90 | 84 | | |
91 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
Lines changed: 3 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
84 | 83 | | |
85 | 84 | | |
86 | 85 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | 86 | | |
92 | 87 | | |
93 | 88 | | |
| |||
157 | 152 | | |
158 | 153 | | |
159 | 154 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
| 155 | + | |
166 | 156 | | |
167 | | - | |
| 157 | + | |
168 | 158 | | |
169 | 159 | | |
170 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
Lines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| |||
416 | 416 | | |
417 | 417 | | |
418 | 418 | | |
419 | | - | |
| 419 | + | |
420 | 420 | | |
421 | 421 | | |
422 | 422 | | |
423 | | - | |
424 | 423 | | |
425 | 424 | | |
426 | 425 | | |
| |||
0 commit comments