Skip to content

fix(title): find nested SVG title elements - #1384

Open
xianjianlf2 wants to merge 1 commit into
testing-library:mainfrom
xianjianlf2:fix/get-by-title-nested-svg-title
Open

fix(title): find nested SVG title elements#1384
xianjianlf2 wants to merge 1 commit into
testing-library:mainfrom
xianjianlf2:fix/get-by-title-nested-svg-title

Conversation

@xianjianlf2

Copy link
Copy Markdown

What changed

Allow ByTitle queries to match SVG <title> elements nested below SVG graphics/container elements, not only direct svg > title children.

Why

SVG titles can be attached to nested graphics elements such as <path><title>...</title></path>. The previous selector only considered direct children of <svg>, so getByTitle could not find those valid nested title elements.

Fixes #974

Validation

  • npm test -- --runTestsByPath src/__tests__/element-queries.js --runInBand --watch=false

Note: the full local validate step is currently blocked in this checkout by @types/node/ffi.d.ts syntax errors from the repository's dependency/TypeScript version combination, before this PR's code is involved.

@codesandbox-ci

codesandbox-ci Bot commented Aug 1, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8d52080:

Sandbox Source
react-testing-library-examples Configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getByTitle for SVGs canot find title if it's not a direct child of svg

1 participant