Skip to content

[Bug]: ContentSwitcher manual activation happens on any key press #20268

@brownjedi

Description

@brownjedi

Package

@carbon/react

Browser

Firefox

Package version

1.88.0

React version

19.1.1

Description

Based on this link, the activation in case of manual selectionMode needs to happen only via Enter or Space.

Currently, it happens on any keypress. I think we need to update the below code to add a check if it's a MouseEvent or if it's a Enter or Space Keyboard event.

} else if (selectedIndex !== index) {
setSelectedIndex(index);
focusSwitch(index);
onChange(event);
}

Reproduction/example

https://react.carbondesignsystem.com/?path=/docs/components-contentswitcher--overview#contentswitcher-selectionmode

Steps to reproduce

Go to the above link. Navigate to a tab via tab key, press any key (for example d) to see the tab activate.

Suggested Severity

None

Application/PAL

No response

Code of Conduct

Metadata

Metadata

Assignees

Type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions