Skip to content

bug: Accessibility tests use brittle selectors and fragile SVG count assertions #4070

@ANSHIKATYAGI30

Description

@ANSHIKATYAGI30

Description

Current issues identified:

  1. The focusable-element selector incorrectly matches elements with tabindex="-1", even though they are intentionally non-focusable.
  2. The SVG count assertion relies on a hardcoded minimum count (>= 27), making the test fragile against harmless visual or animation refactors.

These issues do not necessarily break functionality today, but they reduce long-term test stability and accuracy.

Steps to Reproduce

  1. Open the CherryBlossom.test.tsx accessibility test file.
  2. Locate the selector: 'button,input,textarea,select,a,[tabindex]'
  3. Notice that elements with tabindex="-1" are also matched.
  4. Locate the SVG assertion: expect(svgs.length).toBeGreaterThanOrEqual(27);
  5. Reduce or refactor decorative SVG petals in the component.
  6. Observe that tests fail even when accessibility behavior remains correct.

Expected Behavior

  1. Accessibility tests should only target genuinely keyboard-focusable elements.
  2. Decorative rendering tests should validate presence/functionality without depending on brittle hardcoded implementation counts.
  3. Tests should remain stable during harmless UI or animation refactors.

Environment

Chrome

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions