Skip to content

Commit

Permalink
fix: Fix arrow focus (#3474)
Browse files Browse the repository at this point in the history
Ref #3343
#3080

## Description

1. What is this PR about (link the issue and add a short description)

## 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:
5de6)
- [ ] 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.example`
and the `builder/env-check.js` if mandatory
  • Loading branch information
istarkov authored Jun 2, 2024
1 parent 595696f commit 48503c4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/design-system/src/components/primitives/arrow-focus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 48503c4

Please sign in to comment.