darkreader / darkreader/darkreader

[Bug] [Safari] Extension conflict on websites with Shopify checkout

Open
#15,994 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
22.4k
Forks
2.7k
Avg merge
21h 11m
Merged PRs (30d)
78

Description

### Prerequisites

- [x] I [searched for any existing report](https://github.com/darkreader/darkreader/issues?q=is%3Aissue) about this bug to avoid opening a duplicate.
- [x] I can reproduce this bug in a new, unmodified web browser profile with Dark Reader installed as the only extension.
- [x] I understand I need to use the [Broken Website Report template](https://github.com/darkreader/darkreader/issues/new?assignees=&labels=Broken+Website&template=broken-website-report.yml&title=%5BBroken+Website%5D+Replace+with+title) if this bug I am reporting occurs on a single website.

### Bug Description

DarkReader can conflict with other Safari extensions, causing the web page to become unresponsive, on sites with Shopify checkout. This affects my own Safari extension StopTheMadness Pro: https://apps.apple.com/app/stopthemadness-pro/id6471380298

I've created and attached a reduced test case Safari extension to reproduce the issue. The extension creates a new CSSStyleSheet and adds it to the adoptedStyleSheets of the Shadow DOM. It appears that the DarkReader observer for adopted style sheets is running in an infinite loop.

The Shadow DOM in this case is actually the payment buttons, for example, the PayPal button.

By the way, I lied in prerequisites, because I had to: "I can reproduce this bug in a new, unmodified web browser profile with Dark Reader installed as the only extension." Of course since this is an extension conflict, I had to enable a second extension.

### Website Address

https://kkandjay.com/

### Steps To Reproduce

1. Build and enable the attached Safari extension DarkReaderBug
2. Open https://kkandjay.com/
3. Add an item to the cart
4. Checkout
5. Start entering data in the checkout form

[DarkReaderBug.zip](https://github.com/user-attachments/files/32143903/DarkReaderBug.zip)

### Expected Behavior

The web page remains responsive.

### Actual Behavior

The web page becomes unresponsive. The Safari Web Content process is using ~100% CPU.

### Screenshots

_No response_

### Operating System

macOS 15.7.9

### Web Browser name and version

Safari 26.6.1

### Dark Reader version

2.1.10

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Build and enable the attached DarkReaderBug Safari extension, then reproduce the hang at https://kkandjay.com/ by completing the Shopify checkout flow. Start by tracing the adoptedStyleSheets observer while the reduced extension updates a Shadow DOM stylesheet; done means the checkout remains responsive without the Safari Web Content process reaching about 100% CPU.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.