Skip to content

Restore Tab/Shift+Tab focus-exit test coverage #3122

@bennypowers

Description

@bennypowers

Context

PR #3121 migrated unit tests from Playwright to Puppeteer. Puppeteer cannot move focus outside the browser viewport via Tab/Shift+Tab, so four assertions that verified focus leaving a component were removed or weakened.

Removed/weakened assertions

  1. Accordion: Shift+Tab from first header exits accordion - removed entirely (no prior focusable element to land on)
  2. Accordion: Shift+Tab from last header exits accordion - removed entirely
  3. Accordion: Tab out then Shift+Tab back returns to panel link - removed the Shift+Tab return portion
  4. Search-input: Tab from expanded listbox defocuses combobox - changed from asserting nothing is focused to asserting listbox is closed

What to restore

All four cases test that focus leaves the component entirely via Tab/Shift+Tab. Options:

  • Add Playwright e2e tests (*.e2e.ts) for these keyboard navigation flows, since e2e tests still run on Playwright
  • Investigate whether Puppeteer's page.bringToFront() or CDP Input.dispatchKeyEvent with proper target can simulate Tab-out behavior
  • Use a sentinel focusable element before/after the component in the test fixture to catch focus without needing to leave the page

Files affected

  • elements/pf-v5-accordion/test/pf-accordion.spec.ts
  • elements/pf-v5-search-input/test/pf-search-input.spec.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions