Skip to content

Commit 54f6c1c

Browse files
authored
fix: select "space" autocomplete with mouse (#4339)
Here fixed closing space popover before selecting value from autocomplete with mouse.
1 parent 82c3013 commit 54f6c1c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

apps/builder/app/builder/features/style-panel/sections/shared/input-popover.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const Input = ({
7676
batch.setProperty(property)(styleValue);
7777
batch.publish({ isEphemeral: true });
7878
}}
79-
onChangeComplete={({ value, type, altKey, shiftKey }) => {
79+
onChangeComplete={({ value, altKey, shiftKey }) => {
8080
const batch = createBatchUpdate();
8181
const modifiers = { shiftKey, altKey };
8282
const properties = isSpace(property)
@@ -86,10 +86,8 @@ const Input = ({
8686
for (const property of properties) {
8787
batch.setProperty(property)(value);
8888
}
89-
batch.publish({ isEphemeral: false });
90-
if (type === "blur" || type === "enter") {
91-
onClosePopover();
92-
}
89+
batch.publish();
90+
onClosePopover();
9391
}}
9492
onAbort={() => {
9593
const batch = createBatchUpdate();
@@ -142,7 +140,13 @@ export const InputPopover = ({
142140
<PopoverTrigger asChild>
143141
<Trigger />
144142
</PopoverTrigger>
145-
<PopoverContentStyled hideArrow sideOffset={-24}>
143+
<PopoverContentStyled
144+
hideArrow
145+
sideOffset={-24}
146+
// prevent propagating click on input or combobox menu
147+
// and closing popover before applying changes
148+
onClick={(event) => event.stopPropagation()}
149+
>
146150
<Input
147151
styleSource={styleSource}
148152
value={value}

0 commit comments

Comments
 (0)