Skip to content

[Studio UI] Fix sidebar tab selection firing on every keypress - #4046

Open
idaiv wants to merge 4 commits into
2026.xfrom
fix/sidebar-keydown-guard
Open

[Studio UI] Fix sidebar tab selection firing on every keypress#4046
idaiv wants to merge 4 commits into
2026.xfrom
fix/sidebar-keydown-guard

Conversation

@idaiv

@idaiv idaiv commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The sidebar onKeyDown handler triggered tab selection on any keypress, breaking arrow key navigation
  • Now restricted to Enter and Space only, matching the WAI-ARIA tab pattern
  • Fixes WCAG 2.1 2.1.1 (Keyboard) — sidebar tabs are now properly keyboard-navigable

Test plan

  • Focus a sidebar tab with Tab key
  • Press arrow keys — verify they do NOT trigger tab selection
  • Press Enter — verify it activates the tab
  • Press Space — verify it activates the tab

🤖 Generated with Claude Code

Relates to https://github.com/pimcore/product-management/issues/372

The onKeyDown handler triggered handleSidebarClick on any key,
breaking arrow key navigation within the sidebar. Restrict to
Enter and Space only, matching the WAI-ARIA tab pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 31, 2026 13:17
@idaiv idaiv added the Skip Milestone Check Exempts this PR from the mandatory milestone requirement label Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes unintended sidebar tab activation on arbitrary keypresses by restricting activation to Enter and Space.

Changes:

  • Guards keyboard activation by key.
  • Prevents default Enter/Space behavior.

Assessment:

  • The shared component is the correct boundary and covers all consumers without API breakage.
  • The immediate activation bug is fixed, but arrow-key focus navigation remains unimplemented.
  • No regression test was added.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +130 to 135
onKeyDown={ (event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
handleSidebarClick(entry.key)
}
} }
Comment on lines +130 to +134
onKeyDown={ (event) => {
if (event.key === 'Enter' || event.key === ' ') {
event.preventDefault()
handleSidebarClick(entry.key)
}
idaiv and others added 3 commits August 31, 2026 13:22
Address review: role="tab" elements need arrow key focus movement.
ArrowDown/Right moves to next tab, ArrowUp/Left to previous (wraps).
Also apply roving tabindex: active tab gets tabIndex=0, others -1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@idaiv
idaiv requested a review from vin0401 September 2, 2026 09:10
@idaiv idaiv added this to the 2026.3.0 milestone Sep 2, 2026
@idaiv
idaiv requested a review from martineiber September 2, 2026 10:27
@idaiv idaiv removed the Skip Milestone Check Exempts this PR from the mandatory milestone requirement label Sep 2, 2026
@idaiv
idaiv removed the request for review from martineiber September 2, 2026 10:35
idaiv added a commit that referenced this pull request Sep 4, 2026
* [Studio UI] Add Escape key to collapse sidebar panel

When focus is inside the sidebar content panel, pressing Escape
collapses it (sets active tab to empty). Completes the sidebar
keyboard accessibility alongside PR #4046 which added Enter/Space
tab activation and arrow key navigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Automatic frontend build

* [Studio UI] Move focus to sidebar tab after Escape collapse

When Escape collapses the sidebar, focus was left on the now-hidden
content. Move focus to the previously active tab via rAF so the
keyboard user's position continues from the sidebar navigation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Automatic frontend build

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants