You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to interact with an element rendered by React that has htmlFor set to an ID returned by the useId() hook, the peculiar syntax React uses for IDs in React 18 actually causes an error:
Timed out retrying after 4000ms: Syntax error, unrecognized expression: #react-aria2038921877-:r0:
Note the :r0: portion (I know it says react-aria but under the hood it's using R18's useId API).
We don't want to escape htmlFor because that breaks platform functionality, jQuery should just handle/ignore it.
Interestingly the selector used in Cypress didn't even target that attribute:
I have similar issues with custom query that gets elements based on another element's aria-describedby attributes. IDs in those fields are populated using React.useId().
As work-around I had to refactor the selector a bit:
const id = subject.attr('aria-describedby'); // e.g. ":r3:-error"
- return cy.get(`#${id}-error`); // Fails with "unrecognized expression: #:r3:-error"+ return cy.get(`[id="${id}-error"]`); // Works, generates selector '[id=":r3:-error"]' which works fine
Current behavior
When trying to interact with an element rendered by React that has
htmlFor
set to an ID returned by theuseId()
hook, the peculiar syntax React uses for IDs in React 18 actually causes an error:Note the
:r0:
portion (I know it says react-aria but under the hood it's using R18'suseId
API).We don't want to escape
htmlFor
because that breaks platform functionality, jQuery should just handle/ignore it.Interestingly the selector used in Cypress didn't even target that attribute:
Desired behavior
No response
Test code to reproduce
Example React code:
Then example Cypress test code:
Cypress Version
12.17.4
Node version
20
Operating System
macOS latest
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: