Skip to content

Conversation

afontcu
Copy link
Member

@afontcu afontcu commented Jul 12, 2019

What:

This PR tries to close #313 😇

Why:

getByRole('link') wasn't returning valid anchor elements (read: anchors with href attribute).

How:

I simply check if value is set, and change the return format accordingly. I kept it simple and readable, feel free to suggest some JavaScript calisthenics to improve the resulting function!

Checklist:

  • Documentation added to the docs site N/A
  • Typescript definitions updated N/A
  • Tests
  • Ready to be merged

I discovered that only <a> and <area> suffer from "value-less" attributes. Following is an output of elements provided by aria-query and their associated attribute array:

imatge

Thanks! 👋

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks!

@kentcdodds kentcdodds merged commit 6418536 into master Jul 12, 2019
@kentcdodds kentcdodds deleted the implicit-link-role branch July 12, 2019 17:22
@kentcdodds
Copy link
Member

@all-contributors please add @afontcu for code and tests

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @afontcu! 🎉

@kentcdodds
Copy link
Member

🎉 This PR is included in version 5.5.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get/Log Roles helpers doesn't return anchors when querying link roles

2 participants