patternfly / patternfly/patternfly-react

Menu/Select/Dropdown - considering refactoring focus logic

Open
#11,025 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

PF Team Stale
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Describe the enhancement or change
Following the update that added arrow key handling on menus, we should refactor the logic for when an item is autofocused upon opening via the shouldfocusFirstItemOnOpen prop. Currently it will focus only the first valid item in the menu, but we should tweak it so that:

  • If an item is selected (aria-selected, possibly also if an item with a checkbox is checked), focus should be set on that item (or the first item that matches if multiple are selected).

  • Otherwise focus the first valid item in the menu.

Is this request originating from a Red Hat product team? If so, which ones and is there any sort of deadline for this enhancement?

Any other information?


Jira Issue: PF-11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Menu, Select, and Dropdown focus logic associated with the shouldfocusFirstItemOnOpen prop. Trace how aria-selected and checked items are represented when these components open. Done means the selected item, or the first matching selected item, receives focus; otherwise the first valid item does, with the existing behavior covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.