-
Notifications
You must be signed in to change notification settings - Fork 78
Description
In primeuix/packages/utils/src/dom/methods/getCSSVariableByRegex, the loop iterates over sheet.cssRules without checking whether each rule has a .style property. At-rules such as @layer, @import, @supports, and @property do not have a .style property, so attempting to iterate over rule.style throws an exception. This exception is caught by the catch {} block, causing the entire stylesheet to be skipped — including any subsequent rules that might contain the variable being searched for.
How it was discovered:
The issue was found in a project using PrimeVue. When trying to increase the gap between a dropdown trigger and its overlay panel by overriding --p-anchor-gutter in a global CSS file, the custom value was consistently ignored by the library — it kept reading the default value instead. After investigation, the root cause turned out to be this silent failure: the stylesheet containing the override also had @layer and @import declarations before the :root rule, which caused the entire stylesheet to be skipped during the CSS variable lookup.
Steps to reproduce:
Use a CSS file that contains @layer or @import declarations before the :root { --variable: value } rule.