Skip to content

Commit a82b8f7

Browse files
kofistarkov
authored andcommitted
fix: Show highlighted item in slash menu in content block (#4903)
## Description When opening slash menu in content block and using arrow keys, current item is not highlighted ## 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 fd6b261 commit a82b8f7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

apps/builder/app/builder/features/workspace/canvas-tools/outline/block-instance-outline.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ export const TemplatesMenu = ({
138138
value={value !== undefined ? JSON.stringify(value) : value}
139139
onValueChange={handleValueChangeComplete}
140140
>
141-
{menuItems?.map(({ icon, title, id, value }) => (
141+
{menuItems?.map((item) => (
142142
<DropdownMenuRadioItem
143+
aria-selected={
144+
JSON.stringify(item.value) === JSON.stringify(value)
145+
}
143146
onPointerEnter={() => {
144147
handleValueChange(value);
145148
}}
@@ -165,13 +168,13 @@ export const TemplatesMenu = ({
165168
}
166169
: undefined
167170
}
168-
key={id}
169-
value={JSON.stringify(value)}
171+
key={item.id}
172+
value={JSON.stringify(item.value)}
170173
{...{ [skipInertHandlersAttribute]: true }}
171174
>
172175
<Flex css={{ px: theme.spacing[3] }} gap={2} data-xxx>
173-
{icon}
174-
<Box>{title}</Box>
176+
{item.icon}
177+
<Box>{item.title}</Box>
175178
</Flex>
176179
</DropdownMenuRadioItem>
177180
))}

0 commit comments

Comments
 (0)