Skip to content

[Bug]: remove_overlay_elements can remove body if it has a global popup class #2161

Description

@Nalhin

crawl4ai version

0.9.0

Expected Behavior

html/body tags are never removed from the result even if they have a class with substring "popup".

Ideally html/body should never be removed by the popup removal logic as it always leads to worse result than closing the popup.

Current Behavior

remove_overlay_elements can remove body (leaving empty page) when class name contains "popup".

This is used by some popular wp themes e.g. https://themeforest.net/item/bridge-creative-multipurpose-wordpress-theme/7315054 with class .qode_popup_menu_push_text_right (more details here: https://www.google.com/search?q=qode_popup_menu_push_text_right).

Is this reproducible?

Yes

Inputs Causing the Bug

- https://charlesproper.com/avilene/
- https://carandini.com/en/portfolio_page/angles-tunnel-girona-spain/

Any other website using this theme.

Steps to Reproduce

1. Crawl https://carandini.com/en/portfolio_page/angles-tunnel-girona-spain/ with remove_overlay_elements=True

Code snippets

-

OS

macOS

Python version

3.14

Browser

Chrome

Browser version

No response

Error logs & Screenshots (if applicable)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ⚙️ In-progressIssues, Features requests that are in Progress🐞 BugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions