Links

hide-if-labelled-by

The hide-if-labelled-by snippet hides any HTML element that uses an aria-labelledby, or one of its ancestors, if the related aria element contains the targeted text.
Use this snippet to hide elements based on searched text.

Parameters

Name
Description
Mandatory
search
The string to look for in HTML elements. If the string begins and ends with a slash (/), the text in between is treated as a regular expression.
Yes
selector
The CSS selector of an HTML element that uses an aria-labelledby attribute.
Yes
searchSelector
The CSS selector of an ancestor of the HTML element that uses an aria-labelledby attribute. Defaults to the value of the selector argument.
No

Filter examples

The following table lists examples that use the hide-if-labelled-by snippet:
Filter
Result
hide-if-labelled-by 'Sponsored' FAQ nav
Hides any nav element labelled as Sponsored FAQ. The word FAQ doesn't need to be found inside the direct children of the nav element; it can be anywhere in its subtree.
hide-if-labelled-by inline FAQ nav a
Hides any nav element that has an an inline element whose text content contains the word FAQ.