Skip to content

Commit 0ae431e

Browse files
committed
fix(web): stop modified enter on citation chips
1 parent 32ac46b commit 0ae431e

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎apps/web/src/components/ComposerPromptEditorTiptap.citationDraft.browser.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ it.each(["click", "Enter", " "])(
121121
expect(onCommandKeyDown).toHaveBeenCalledWith("Enter", expect.any(KeyboardEvent), false);
122122
onCommandKeyDown.mockClear();
123123
const chip = screen.getByRole("link", { name: "View cited assistant text: hello" });
124+
chip.element().focus();
125+
await userEvent.keyboard("{Control>}{Enter}{/Control}");
126+
expect(onCommandKeyDown).not.toHaveBeenCalled();
124127
for (const init of [
125128
{ ctrlKey: true },
126129
{ metaKey: true },

‎apps/web/src/components/chat/AssistantCitationChip.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ export function AssistantCitationChip({
154154
render={<Link {...sourceLinkProps} />}
155155
data-citation-comment-trigger={commentEditor ? "true" : undefined}
156156
onKeyDownCapture={(event) => {
157+
if (event.key === "Enter") event.stopPropagation();
157158
if (
158159
(event.key !== " " && event.key !== "Enter") ||
159160
event.metaKey ||

0 commit comments

Comments
 (0)