Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using d2l-link in object-property-item-link #5183

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

ChrisLabattD2L
Copy link
Contributor

@ChrisLabattD2L ChrisLabattD2L commented Nov 27, 2024

GAUD-7228

Due to not using the d2l-link component, when target="_blank", we weren't showing the "open in a new tab" functionality, so I've switched the object-property-item-link to use the d2l-link component instead of just the styling.

Copy link
Contributor

Thanks for the PR! 🎉

We've deployed an automatic preview for this PR - you can see your changes here:

URL https://live.d2l.dev/prs/BrightspaceUI/core/pr-5183/

Note

The build needs to finish before your changes are deployed.
Changes to the PR will automatically update the instance.

@ChrisLabattD2L ChrisLabattD2L marked this pull request as ready for review November 27, 2024 20:42
@ChrisLabattD2L ChrisLabattD2L requested a review from a team as a code owner November 27, 2024 20:42
}

render() {
return html`
${this._renderIcon()}
${!this.skeleton ? html`
<a
<d2l-link
aria-label="${this.text}"
Copy link
Member

Choose a reason for hiding this comment

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

The aria-label shouldn't be needed? I'd expect its label to come from its internals via renderText().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd mostly added it since it was a property of d2l-link, but you're right that it should just be handled within renderText. Though it does beg the question, if this component should have some property to provide more context to screen reader users like how aria-label is currently doing for d2l-link. I'm good with just removing it for now though!

Copy link
Member

Choose a reason for hiding this comment

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

Setting aria-label in this way actually replaces the contents, so there wouldn't be more context in the same way aria-description might provide.

Having aria-label on <d2l-link> as a passthrough to its underlying <a>'s aria-label was a mistake we made initially. All the aria-* attribute are obviously native attributes and aXe has actually started complaining recently when we put them on custom elements.

What we should have done (and have correct in newer things) is to use a combination of text (or label) and text-hidden/label-hidden to flip that to the aria-label of the native element. And then add something like a description attribute to go into the aria-description.

@ChrisLabattD2L ChrisLabattD2L merged commit 18d0cc2 into main Nov 27, 2024
6 checks passed
@ChrisLabattD2L ChrisLabattD2L deleted the clabatt/fix-object-property-list-link-new-tab branch November 27, 2024 21:19
Copy link

🎉 This PR is included in version 3.74.1 🎉

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.

2 participants