@testing-library/dom version: 7.22.2import React from "react";
export default function App() {
return <button title="">OK</button>;
}
screen.getByRole("button", { name: /ok/i });
Unable to find an accessible element with the role "button" and name `/ok/i`
Here are the accessible roles:
button:
Name "":
<button
title=""
/>
https://codesandbox.io/s/happy-chandrasekhar-311qt?file=/src/App.js
Chrome reports that the button has a name:

But getByRole says it does not.
JSFiddle: https://jsfiddle.net/91retmv2/
Firefox also reports that the button has a name.
Thanks for the report. Will take a look at it over at https://github.com/eps1lon/dom-accessibility-api/issues/393
:tada: This issue has been resolved in version 7.22.3 :tada:
The release is available on:
npm package (@latest dist-tag)Your semantic-release bot :package::rocket: