Description
Brave's :matches-path()
currently has two issues that affect the way it works in Brave.
-
When a website doesn't use the normal navigation and uses JS History API like
pushState()
the:matches-path()
will not work on navigation and only when you refresh the path or go directly to it. -
when elements get properly hidden for matching a
:matches-path()
rule, when you navigate away from the matching path where the rule doesn't/shouldn't apply anymore, thedisplay: none !important
property stays in the elements causing the elements to be hidden until page is refreshed.
Note: This issue also affect the other Procedurals, but:matches-path()
is the one where it matters and it is needed the most.
Example:
- Add
smite2.com##:matches-path(founders) .flex.items-center.gap-2
as a custom filter. - Go to smite2.com
- Navigate to the
FOUNDER'S EDITION
through the menu, but thePLAY FREE NOW
doesn't hide dynamically going to thefounders-edition
path. - Refresh the page
founders-edition
path and now the item gets properly hidden. - Hit back button or click on another item in the menu, and the item will stay hidden.
20250528-2150-46.2583587.mp4
Extra information
Like I said, elements keeping the display: none !important
from a procedural, even if a rule doesn't match anymore, is not limited to :matches-path()
but I hope it gets fixed for every other procedural.
But even if the element is forced to update by removing it from the DOM with Devtools and then undo the action with Ctrl+Z, the element keeps the display: none !important
in Brave.
Example:
- add
smite2.com##.hidden.xl\:block > a:has-text(/game mode/i)
- open Devtools and find the element
.hidden.xl\:block > a:nth-child(2)
- change the
Game Mode
text forwhatever
. - Select the element and delete it and then undo it with ctrl+z
- the item will keep the
display: none !important
- try the same in uBlock, and you will notice that the item re-appears with the new text and the element in the DOM will only have one of the two attributes that procedurals use to hide the element.
Brave:
20250528-2215-28.2777432.mp4
uBlock
20250528-2220-32.5818968.mp4
As can be seen by the example, uBlock doesn't keep the display: none !important
in the element on delete/undo action since the rule is not matching anymore.
So this is the something that happens in :matches-path
because the element keeps the display: none !important
even on a delete/undo the element and even if the path is different where is not matching the :matches-path()
rule at all.