Skip to content

Fix click-outside-lite shadow DOM, once cleanup and ignore validation - #19

Merged
arnelirobles merged 1 commit into
mainfrom
fix/click-outside-lite-composed-path
Nov 12, 2026
Merged

arnelirobles merged 1 commit into
mainfrom
fix/click-outside-lite-composed-path

Conversation

@arnelirobles

Copy link
Copy Markdown
Contributor

Fixes the plain parts of F9. The inside check uses event.composedPath() (with the old contains check as a fallback), so a click inside an element that lives in a shadow root is no longer reported as outside. The once cleanup runs in a finally, so a throwing callback does not leave the listener behind. An invalid ignore selector throws once at setup, before any listener is added, instead of on every event.

Not changed, a design decision: the touchstart then mousedown double fire.

Tests: packages/click-outside-lite/src/index.test.ts, new shadow DOM, once and ignore validation block (jsdom). 3 fail on main, all 14 pass here, tsc clean.

- test: packages/click-outside-lite/src/index.test.ts
  breaks: packages/click-outside-lite/src/index.ts "const within = (el: Element) => path.includes(el) || el.contains(target);"
- test: packages/click-outside-lite/src/index.test.ts
  breaks: packages/click-outside-lite/src/index.ts "} finally {"
- test: packages/click-outside-lite/src/index.test.ts
  breaks: packages/click-outside-lite/src/index.ts "ignore.forEach(selector => document.querySelector(selector));"

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 821bdf1b-400d-4aa7-850c-ee8a568d39ad
Commits

Reviewing files that changed from the base of the PR and between 0f20b1a and 612a32c.

Files selected for processing: 3

  • .changeset/click-outside-lite-fixes.md
  • packages/click-outside-lite/src/index.test.ts
  • packages/click-outside-lite/src/index.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@arnelirobles
arnelirobles marked this pull request as ready for review November 12, 2026 15:33
@arnelirobles
arnelirobles merged commit 9cb5802 into main Nov 12, 2026
2 checks passed
@arnelirobles
arnelirobles deleted the fix/click-outside-lite-composed-path branch November 12, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant