fix(suggestion): preserve space input in editable triggers - #1999
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
🤔 This is a ...
🔗 Related Issues
Fixes #1873
💡 Background and Solution
When
SuggestionwrapsSender, the editable control is rendered inside theCascadertrigger. Space key events can continue to the Cascader/rc-select keyboard handler, where Space is treated as a dropdown control key and its default behavior is prevented. As a result, the Sender cannot insert a space.This PR adds a deliberately scoped compatibility fix in
Suggestion:contenteditableelement;preventDefault(), so native space insertion is preserved;This is not the root-cause fix in Cascader/rc-select. The underlying issue is that rc-select infers editability from its own mode and
showSearchstate instead of inspecting the actual event target inside a custom trigger. Fixing that behavior upstream requires a separate rc-select change and the subsequent Cascader/antd dependency release chain. This local guard resolves #1873 without waiting for that chain and can be reconsidered after an upstream fix is available.Regression coverage includes the popup-open and popup-closed paths, the default Sender textarea, input slots, contenteditable slots, modifier shortcuts, and non-editable controls.
✅ Validation
npx jest --config .jest.js components/suggestion/__tests__/useActive.test.tsx components/suggestion/__tests__/index.test.tsx --runInBand --coverage=false --no-cachenpx biome check packages/x/components/suggestion/useActive.ts packages/x/components/suggestion/__tests__/useActive.test.tsx packages/x/components/suggestion/__tests__/index.test.tsxnpm run lint:script --workspace packages/xsender/hooks/use-speech.ts.npx size-limit packages/x/dist/antdx.min.js --limit '520 KiB'/followed by Space produces"/ ".Local full
tscand declaration generation are currently blocked by four unrelated existing errors incomponents/attachments/index.tsxandcomponents/file-card/components/ImageLoading.tsx; the focused type/lint/test paths for this change pass.📝 Change Log