Skip to content

Commit 47e15ab

Browse files
authored
fix: Fix local token clickable area (#4922)
## Description 1. Local token clickable area is now the entire button surface, closes #4864 2. When editing token name, now local doesn't jump around ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 10b7f06 commit 47e15ab

File tree

2 files changed

+22
-31
lines changed

2 files changed

+22
-31
lines changed

apps/builder/app/builder/features/style-panel/style-source/style-source-control.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,20 +318,13 @@ export const StyleSourceControl = ({
318318
disabled={disabled}
319319
aria-current={selected && state === undefined}
320320
role="button"
321+
onClick={onSelect}
321322
hasError={error !== undefined}
322323
>
323-
<Flex
324-
grow
325-
css={{
326-
position: "relative",
327-
paddingBlock: theme.spacing[3],
328-
paddingInline: theme.spacing[4],
329-
}}
330-
>
324+
<Flex grow css={{ padding: theme.spacing[2] }}>
331325
<StyleSourceButton
332326
disabled={disabled || isEditing}
333327
isEditing={isEditing}
334-
onClick={onSelect}
335328
tabIndex={-1}
336329
>
337330
<Flex align="center" justify="center" gap="1">

apps/builder/app/builder/features/style-panel/style-source/style-source-input.tsx

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -204,28 +204,26 @@ const TextFieldBase: ForwardRefRenderFunction<
204204
onKeyDown={onKeyDown}
205205
>
206206
{/* We want input to be the first element in DOM so it receives the focus first */}
207-
{editingItemId === undefined && (
208-
<InputField
209-
{...textFieldProps}
210-
variant="chromeless"
211-
css={{
212-
fontVariantNumeric: "tabular-nums",
213-
lineHeight: 1,
214-
order: 1,
215-
flex: 1,
216-
"&:focus-within, &:hover": {
217-
borderColor: "transparent",
218-
},
219-
}}
220-
size="1"
221-
value={label}
222-
onClick={onClick}
223-
ref={inputRef}
224-
inputRef={internalInputRef}
225-
spellCheck={false}
226-
aria-label="New Style Source Input"
227-
/>
228-
)}
207+
<InputField
208+
{...textFieldProps}
209+
variant="chromeless"
210+
css={{
211+
fontVariantNumeric: "tabular-nums",
212+
lineHeight: 1,
213+
order: 1,
214+
flex: 1,
215+
"&:focus-within, &:hover": {
216+
borderColor: "transparent",
217+
},
218+
}}
219+
size="1"
220+
value={label}
221+
onClick={onClick}
222+
ref={inputRef}
223+
inputRef={internalInputRef}
224+
spellCheck={false}
225+
aria-label="New Style Source Input"
226+
/>
229227
{value.map((item) => (
230228
<StyleSourceControl
231229
key={item.id}

0 commit comments

Comments
 (0)