AdguardTeam / AdguardForiOS

The most advanced ad blocker for iOS
https://adguard.com/
GNU General Public License v3.0
1.4k stars 201 forks source link

Extended CSS selectors not working on Facebook (:xpath, :contains) #2283

Closed ethan-xd closed 4 months ago

ethan-xd commented 5 months ago

Prerequisites

Please answer the following questions for yourself before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.

Issue Details

Expected Behavior

I am trying two filters I know to work on desktop, and have checked the HTML with Web Inspector, to block suggested posts on Facebook.

Both of these aim to do the same thing:

facebook.com#?#:xpath("//div[@aria-posinset and .//h4//*[@role='button' and .='Follow']]") facebook.com#?#[aria-posinset]:has(h4 [role=button]:contains(/^Follow$/))

But the post is not blocked.

Actual Behavior

The post should be removed, like what happens on desktop (uBlock Origin for Firefox).

Screenshots

View screenshots to see it working on desktop and not iOS.

Screenshot: ### `:xpath` rule on desktop ![image](https://github.com/AdguardTeam/AdguardForiOS/assets/24442053/ab177fb9-04ab-4ff3-8f11-f83d0124e558) ### `:contains` rule on desktop ![image](https://github.com/AdguardTeam/AdguardForiOS/assets/24442053/7fe5459a-05fb-4681-937c-732e1dbd0660) ### Both rules on iOS ![image](https://github.com/AdguardTeam/AdguardForiOS/assets/24442053/8b9d82a2-a201-4299-844c-c1f897ddd300) (The third rule not circled funnily enough does work, even without `#?#`.)

Additional Information

I have force closed and reopened, toggled off and on multiple times. I have seen rules finding elements contained in that post work without using extended CSS selectors (a basic ##h4 [role=button] rule for example). I have tried simpler rules for :contains (like ##span:contains(Like)) which also don't work. I have not yet tested this on another site. I also tested the rules on iPhone 13 iOS 17.0 to no avail.

ESurina commented 4 months ago

Elements may be named differently on a desktop and a mobile device. Please try to Open AdGuard action extension (go to Safari -> tap on Extensions button in the URL bar -> tap on AdGuard), then tap on "Block elements on this page" and choose an element. So the rule will be added.

ethan-xd commented 4 months ago

@ESurina I am using show desktop view and I have verified via Web Inspector extension for Safari that the HTML is the same and it should be caught here.

ESurina commented 4 months ago

Please launch AdGuard, go to settings -> Support -> Report incorrect blocking and send a report. If you have a saved link to the post, please send it to filters@adguard.com, mentioning a link to the report (to the comment).