diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts index 30e0394075..9eddf27ba8 100644 --- a/client/src/utils/__tests__/svg.test.ts +++ b/client/src/utils/__tests__/svg.test.ts @@ -209,6 +209,24 @@ describe('isMonochromeSvg', () => { expect(isMonochromeSvg(svg)).toBe(true); }); + it('ignores a referenced color rendered only through an opacity-zero use', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); + + it('ignores a nested referenced color hidden by an opacity-zero use', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); + + it('ignores a default-black use hidden with opacity zero', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); + it('tints a referenced glyph whose own fill overrides the use fill', () => { const svg = ''; diff --git a/client/src/utils/svg.ts b/client/src/utils/svg.ts index 54c7e4f8d6..32943df263 100644 --- a/client/src/utils/svg.ts +++ b/client/src/utils/svg.ts @@ -342,8 +342,8 @@ function currentColorTones( * instantiating `` elements, so its template paint counts even though it * lives in a deferred container, and `currentColor` can resolve against the * instance's inherited `color`. Nested `` inside a referenced template are - * followed too (a symbol may reference another template). Hidden uses render - * nothing and are skipped; a `seen` set guards against reference cycles. + * followed too (a symbol may reference another template). Hidden or opacity-zero + * uses render nothing and are skipped; a `seen` set guards against reference cycles. */ function referenceMap(root: Element, rules: StyleRule[]): Map { const map = new Map(); @@ -365,7 +365,7 @@ function referenceMap(root: Element, rules: StyleRule[]): Map