Skip to content

[Bug] Unresponsive page with 100% CPU #14790

Closed

Description

@ocavue

Prerequisites

  • I searched for any existing report about this bug to avoid opening a duplicate.
  • I can reproduce this bug in a new, unmodified web browser profile with Dark Reader installed as the only extension.
  • I understand I need to use the Broken Website Report template if this bug I am reporting occurs on a single website.

Bug Description

My webpage becomes unresponsive with 100% CPU usage when dark mode is enabled.

Website Address

https://prosekit.dev/playground/-/react/full/

Steps To Reproduce

  1. Open a Chrome Incognito window
  2. Make sure Dark Reader is off
  3. Go to https://prosekit.dev/playground/-/react/full/ or https://1afb35f4.prosekit-dev.pages.dev/playground/-/react/full/
  4. The CPU usage is normal, and the webpage is interactive
  5. Turn on Dark Reader
  6. The CPU usage reaches 100%, and the webpage is frozen

Expected Behavior

The webpage is not frozen

Actual Behavior

The webpage is frozen

Screenshots

CleanShot.2025-11-15.at.18.05.36.mp4

Operating System

macOS

Web Browser name and version

Chrome 142.0.7444.135

Dark Reader version

Dark Reader 4.9.113

Additional Context

No response

Activity

  1. alexanderby commented on Nov 15, 2025

    @alexanderby
    Member

    Nice example, thank you.

  2. alexanderby commented on Nov 18, 2025

    @alexanderby
    Member

    I've lost access unfortunately: Internal server error.

  3. ocavue commented on Nov 18, 2025

    @ocavue
    Author
  4. alexanderby commented on Nov 18, 2025

    @alexanderby
    Member

    The problem is, this library rebuilds the code blocks' HTML entirely after Dark Reader inserts its inline style. We are working on stopping injecting inline styles. But in the meantime we will ignore the containers with [data-node-view-content] attribute.

    The other question is, why dark theme is not being detected.

  5. ocavue commented on Nov 18, 2025

    @ocavue
    Author

    this library rebuilds the code blocks' HTML entirely after Dark Reader inserts its inline style.

    ProseMirror uses MutationObserver (domobserver.ts#L53) to monitor the changes in contenteditable elements, update its inner state, and then trigger a re-rendering. That's probally why it rebuilds when Dark Reader inserts style.

    But in the meantime we will ignore the containers with [data-node-view-content] attribute.

    Thank you so much for your support! I just wanted to clarify a small detail in your commit. The [data-node-view-content] attribute isn't set by ProseMirror; it's actually set by a library called prosemirror-adapter at CoreNodeView.ts#L50.

    I maintain both ProseKit and prosemirror-adapter, so I'm here to help if there's anything I can assist with. Perhaps providing a website link with source maps and without JavaScript minification would be helpful? Do you have any advice on how I can skip some updates on the ProseKit / prosemirror-adapter / ProseMirror side?

    The other question is, why dark theme is not being detected.

    I'm not quite sure what you mean. If you open https://prosekit.dev, you should be able to toggle between the dark and light themes by clicking the moon icon button in the top-right corner. This button will do the following things to the root <html> element:

    1. toggle data-theme="dark" / data-theme="light"
    2. toggle the dark class
    3. toggle inline style color-scheme: dark;

    Should Dark Reader use the website's native dark theme (i.e., a dark class name) when possible?

    The dark theme toggle feature is powered by a small library written by me. You can see an online website for testing here: https://astro-theme-toggle.pages.dev/

  6. added a commit that references this issue on Nov 18, 2025
    09690ae
  7. alexanderby commented on Nov 19, 2025

    @alexanderby
    Member

    I found the cause for not detecting the dark mode, it will be available in the next release, as well as the patch for the Mutation Observer.

    Maybe if the observer won't react on style attribute changes, or won't rebuild the DOM and reused the existing nodes, it would work better. Dark Reader has its own observer for new nodes with inline styles, and the cycle repeats endlessly.

    But anyway, we are working on avoiding DOM manipulations, and since the quick fix is working, there's no need to make any changes on your side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions