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 arrow focus (#3474)

Ivan Starkov48503c40e6e2
diff --git a/packages/design-system/src/components/primitives/arrow-focus.tsx b/packages/design-system/src/components/primitives/arrow-focus.tsx
index 03d8219911..7cb6da5404 100644
--- a/packages/design-system/src/components/primitives/arrow-focus.tsx
+++ b/packages/design-system/src/components/primitives/arrow-focus.tsx
@@ -61,6 +61,19 @@ const ContextHelper = ({ render }: { render: Render }) => {
event: KeyboardEvent,
focusManagerOptions?: FocusManagerOptions
) => {
+ if (event.defaultPrevented) {
+ return;
+ }
+
+ if (
+ event.target instanceof Element &&
+ false === event.currentTarget.contains(event.target)
+ ) {
+ // Event occurs inside a portal, typically within a popover or dialog, but the handler is outside the popover/dialog.
+ // Ignore these events as they do not affect focus outside the dialog.
+ return;
+ }
+
if (willEventMoveCaret(event)) {
return;
}