Skip to content

Replace keydown for Enter/Space with click events #8370

@thatblindgeye

Description

@thatblindgeye

Is this a new component or an extension of an existing one?
Existing components

Describe the feature
There are cases where components utilize a keydown event to detect if "Enter" or "Space" is pressed on a keyboard, such as for menu toggles in dropdown-like components. As mentioned in #8319 (comment), we should be able to instead leverage the click event in some of these cases and just check that event.detail === 0. This should help resolve any bugs where we need to set a timeout/where Space doesn't autofocus a menu item and such. This solution wouldn't apply to cases where Enter or Space are not being used to trigger a similar click event.

There are also cases in the codebase where when Space or Enter are pressed, e.target.click() (or the some click handling method) is called (such as NotificationDrawerListItem), which can be useful in cases where Space or Enter don't register as a "click" event on an element.

Components that could possibly be updated to either of these two methods:

Metadata

Metadata

Assignees

Labels

Breaking change 💥this change requires a major release and has API changes.PF5

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions