patternfly / patternfly/patternfly-react

Drawer - automatically manage focus when drawer is opened/closed

Open
#8,534 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A11y Breaking change :boom: PF Team
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Follow up for core issue https://github.com/patternfly/patternfly/issues/5319
A more consistent solution than was used to fix https://github.com/patternfly/patternfly-react/issues/8394

move the close button to the top of the drawer body rather than the end.

The modal component automatically places focus on the first interactable element in the modal when it is opened.
In the case of the Drawer, that should be the close button by default.
If the close button is not provided, then it should be the first interactable element in the drawer.
If there are no interactable elements, focus should be placed on the drawer body.

Like the modal, this should happen automatically for the drawer, unless overridden by the consumer.

When the drawer is closed, focus should be returned to the drawer toggle - or at least, the props needed for the consumer to implement this focus management should be exposed. All related examples/demos should be updated to use this behavior (including the wizard with drawer)


Jira Issue: PF-145

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 comparing the Drawer focus behavior with the existing Modal behavior and review the Drawer examples, including the wizard with drawer. Implement the stated open and close focus behavior with consumer overrides, then update all related examples and demos. Done means focus reaches the close button, the first interactable element, or the drawer body as appropriate, and returns to the drawer toggle when closed.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.