Skip to content

feat: GAUD-10654 support target attribute - #7518

Merged
EdwinACL831 merged 15 commits into
mainfrom
ecollazos/GAUD-10654_support_target_attribute
Sep 23, 2026
Merged

EdwinACL831 merged 15 commits into
mainfrom
ecollazos/GAUD-10654_support_target_attribute

Conversation

@EdwinACL831

@EdwinACL831 EdwinACL831 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Jira

GAUD-10654

Description

There could be use-cases where we want that the d2l-empty-state-action-link opens the link, for example, on a new browser tabs. This is done by giving support to the HTML target attribute that gets set in the shadow dom, on the anchor element.

@github-actions

Copy link
Copy Markdown
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-7518/

Note

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

Comment thread components/icons/icon-styles.js Outdated
/**
* A private helper method that should not be used by general consumers
*/
export const _generateInlineLinkIconStyles = (iconContainerId) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I encapsulated these styles into this generator, so they could be reused. Currently used on d2l-link and d2l-empty-state-action-link

Comment thread components/empty-state/empty-state-action-link.js
Comment thread components/link/link.js
a span.truncate-one {
${overflowEllipsisDeclarations}
}
#new-window {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These styles where moved to the new generator function _generateInlineLinkIconStyles.

@EdwinACL831
EdwinACL831 marked this pull request as ready for review September 22, 2026 21:06
@EdwinACL831
EdwinACL831 requested a review from a team as a code owner September 22, 2026 21:06
@EdwinACL831 EdwinACL831 changed the title GAUD-10654: support target attribute feat: GAUD-10654 support target attribute Sep 23, 2026
* REQUIRED: The action URL or URL fragment of the link
* @type {string}
*/
href: { type: String, required: true },

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This comes for free within the LinkMixin

* REQUIRED: The action URL or URL fragment of the link
* @type {string}
*/
href: { type: String, required: true },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given that this used to do the validation, and LinkMixin does not, perhaps we should keep this property definition (I think it would just override the mixin's). Separately, we should look into whether we can make it required field on LinkMixin.

: nothing;

return html`${actionLink}`;
if (!this.text || !this.href) return nothing;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm, this is different. Previously it was returning an html template string containing nothing, whereas now we are returning nothing (Symbol(lit-nothing)) from render. Do you know if it's valid to return this from render? This might be ok, but I'm not sure we've ever done this before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think normally we would just return;.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed it is ok (things that can be returned).

@EdwinACL831 EdwinACL831 Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, I came here to write my response and saw also you did the search. In addition, I also tested it locally. but Yeah on lit documentation the nothing sentinel is a valid return for the render method (it is renderable)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@EdwinACL831
EdwinACL831 merged commit e444266 into main Sep 23, 2026
11 checks passed
@EdwinACL831
EdwinACL831 deleted the ecollazos/GAUD-10654_support_target_attribute branch September 23, 2026 18:20
@d2l-github-release-tokens

Copy link
Copy Markdown

🎉 This PR is included in version 3.320.0 🎉

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