Skip to content

isolateEvents breaks Svelte 5 event listeners #2385

@chergav

Description

@chergav

Describe the bug

isolateEvents: true breaks keyboard navigation inside shadow root UI when using Svelte 5 (and likely React, Vue with event delegation).

@webext-core/isolated-element v1.x attaches stopPropagation listener on body inside the shadow root. Svelte 5 uses event delegation — it registers its own keydown listener on the same body. Since WXT's listener is registered first, it calls stopPropagation before Svelte's delegation handler runs, so component event handlers

@webext-core/isolated-element v2 moves the listener to shadowRoot instead of body

Reproduction

below

Steps to reproduce

Use createShadowRootUi with isolateEvents: true
Mount a Svelte 5 app with keyboard handlers (onkeydown on any element)
Press any key — handler never fires

System Info

Binaries:
    Node: 26.1.0 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 11.14.1 - /usr/bin/npm
    pnpm: 10.33.0 - /usr/bin/pnpm
  Browsers:
    Chromium: 148.0.7778.167
  npmPackages:
    vite: ^8.0.8 => 8.0.8 
    wxt: ^0.20.25 => 0.20.25

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bug

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions