Skip to content

Fix/widgets bind handlekey - #3355

Open
Nehachavan03 wants to merge 3 commits into
Karanjot786:mainfrom
Nehachavan03:fix/widgets-bind-handlekey
Open

Fix/widgets bind handlekey#3355
Nehachavan03 wants to merge 3 commits into
Karanjot786:mainfrom
Nehachavan03:fix/widgets-bind-handlekey

Conversation

@Nehachavan03

Copy link
Copy Markdown
Contributor

Description

This pull request resolves a critical issue where several key-interactive widgets (ThinkingBlock, SplitPane, and Accordion) implemented a handleKey method to handle user inputs (toggling collapse states, resizing panes, and navigating headers) but never registered this handler with the widget's event emitter (this.events). As a result, keyboard interaction was completely non-functional in live applications.

This change binds the key event listener in the constructor and re-binds/registers it inside mount() to ensure handlers are preserved correctly across mount and unmount lifecycles.

Changes:

  • ThinkingBlock.ts: Registered _keyHandler to call handleKey in the constructor and mount().
  • SplitPane.ts: Registered _keyHandler to call handleKey in the constructor and overridden mount().
  • Accordion.ts: Registered _keyHandler to call handleKey in the constructor and overridden mount().
  • remount-key-handlers.test.ts: Added tests for ThinkingBlock, SplitPane, and Accordion to verify key handling works and is restored upon widget remounting.

Related Issues

Closes #3352

Type of Change

  • Refactoring (non-breaking change which improves code quality and style alignment)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Verification & Testing

The following checks were run successfully on this branch:

  • bun run build (All packages built successfully)
  • bun vitest run packages/widgets/src/remount-key-handlers.test.ts (All 6 tests passed, including the new ThinkingBlock, SplitPane, and Accordion tests)
  • bun run typecheck (No TypeScript / type-checking errors)

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Nehachavan03, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ffb06c1-2b61-4836-88d5-b0366c4cffc1

📥 Commits

Reviewing files that changed from the base of the PR and between 48f63a1 and dd95819.

📒 Files selected for processing (4)
  • packages/widgets/src/display/Accordion.ts
  • packages/widgets/src/display/ThinkingBlock.ts
  • packages/widgets/src/layout/SplitPane.ts
  • packages/widgets/src/remount-key-handlers.test.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added area:widgets @termuijs/widgets type:testing +10 pts. Tests. labels Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:widgets @termuijs/widgets type:testing +10 pts. Tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] fix(widgets): bind key events to handleKey in ThinkingBlock, SplitPane, and Accordion

1 participant