← Back to context

Comment by c-hendricks

10 days ago

Last I tried writing custom rules for Facebook was years ago, but they did have proper aria attributes, and uBlock origin does have selectors for text content. These are from 2020:

  facebook.com##span:has-text(Suggested for You):xpath(../../../../../../../../../../../../../../../../../..)
  facebook.com##div[aria-label="Sponsored"] span[aria-label="Sponsored"]:xpath(../../../../../../../../../../../../../../../../../../../../..)
  facebook.com##div[aria-label="Sponsored"]:xpath(../../../../../../../../../../../../../../../../../../../..)

you can use upward. For example

  facebook.com##span:has-text(Suggested for You):upward(8)

That then goes up elements in the dom.

What's with the xpath selector? Is that just matching deeply nested elements?

  • Going from memory, but that's how many elements are in the tree between what I wanted to be hidden and where the matching text/elements actually lived.

    • Oh jeez, I hadn’t thought about the blocked element being different than the aria-tagged one. What a nightmare