Fix/widgets bind handlekey - #3355
Conversation
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
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. Comment |
Description
This pull request resolves a critical issue where several key-interactive widgets (
ThinkingBlock,SplitPane, andAccordion) implemented ahandleKeymethod 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:
_keyHandlerto callhandleKeyin the constructor andmount()._keyHandlerto callhandleKeyin the constructor and overriddenmount()._keyHandlerto callhandleKeyin the constructor and overriddenmount().ThinkingBlock,SplitPane, andAccordionto verify key handling works and is restored upon widget remounting.Related Issues
Closes #3352
Type of Change
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 newThinkingBlock,SplitPane, andAccordiontests)bun run typecheck(No TypeScript / type-checking errors)