Skip to content

fix(steps): trigger click handlers from keyboard activation - #77

Open
aibayanyu20 wants to merge 1 commit into
nextfrom
sync/rc-component-steps-395
Open

fix(steps): trigger click handlers from keyboard activation#77
aibayanyu20 wants to merge 1 commit into
nextfrom
sync/rc-component-steps-395

Conversation

@aibayanyu20

Copy link
Copy Markdown
Member

Summary

  • activate clickable steps with Enter and Space
  • route keyboard activation through the native click path so item and parent callbacks stay consistent
  • prevent the default Space scrolling behavior

Upstream

Verification

  • targeted keyboard regression test passed
  • lint passed

Note: the package full suite has pre-existing snapshot and DOM selector failures on next; snapshots were intentionally not rewritten in this PR.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ace905626

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +116 to +118
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
e.currentTarget.click()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ignore bubbled keyboard events from nested controls

When a clickable step's title or content contains an input, link, or button, its Space/Enter keydown bubbles to this handler. Calling preventDefault() then blocks the nested control's behavior—for example, Space can no longer be typed into an input and Enter cannot activate a link—while currentTarget.click() activates the entire step instead. Only synthesize the step click when the step element itself is the event target, or otherwise exclude key events originating from nested interactive elements.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant