Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: fix blinking navigator item focus ring (#3919)

Oleg Isonen1c7cfe1de8cf
diff --git a/packages/design-system/src/components/tree/tree-node.tsx b/packages/design-system/src/components/tree/tree-node.tsx
index 0123340aef..d9d96ab667 100644
--- a/packages/design-system/src/components/tree/tree-node.tsx
+++ b/packages/design-system/src/components/tree/tree-node.tsx
@@ -417,7 +417,13 @@ export const TreeItemBody = <Data extends { id: string }>({
style={{ left: (level - 1) * INDENT + ITEM_PADDING_LEFT }}
// We don't want this trigger to be focusable
tabIndex={-1}
- onClick={(event) => onToggle(event.altKey)}
+ onClick={(event) => {
+ // If we don't stop propagation, the currently focused item will loose focus and then regain it
+ // which will result in blinking outline.
+ // We prefer to focus the collapsible trigger instead since it is also a button and it was actually clicked.
+ event.stopPropagation();
+ onToggle(event.altKey);
+ }}
>
{isExpanded ? <ChevronFilledDownIcon /> : <ChevronFilledRightIcon />}
</CollapsibleTrigger>