In develop environment role queries not appear in ResultQueries
delca85 opened this issue Β· comments
Bug Report π
On https://develop.testing-playground.com/, clicking on an input
element, the getByRole
query is rightly inserted (and evaluated) in QueryEditor
but it does not appear in ResultQueries
.
Clicking on a button
element does not reproduce this bug, the role
query appears in ResultQueries
.
To Reproduce βοΈ
- inserted markup
- select an input element
Expected behavior π€
I expected the getByRole
query would appear in ResultQueries
as it happens in the button
case.
Suggested solution π¦
Your Environment π»
- browser: Chrome
- os: Mac
I just found this comment. The inserted markup indeed had the type
attribute specified (it was email
) but it does not work anyway while if I set it to textbox
the query is rightly suggested in ResultQueries
.
I feel like not all the parts of the playground are using suggestions generated by testing-library/dom. That should make cases like these impossible.
Ok, I got your point but I think that maybe we could improve the playground suggestion in case of input
with a defined type
even if it is not text
.
If I am not wrong, this is where we create the role
suggestion.
In case of we are evaluating an input
element the getRole
by dom-accessibility-api is called only if the type
attribute is text
. I think that we could call getRole
anyway because dom-accessibility-api
manages every possible value of an input
element (an undefined value too).
If it sounds reasonable to you I could open a PR.
Sounds good to me.