feat: GAUD-10654 support target attribute - #7518
Conversation
…mpty-state-action-link.
|
Thanks for the PR! 🎉 We've deployed an automatic preview for this PR - you can see your changes here:
Note The build needs to finish before your changes are deployed. |
| /** | ||
| * A private helper method that should not be used by general consumers | ||
| */ | ||
| export const _generateInlineLinkIconStyles = (iconContainerId) => { |
There was a problem hiding this comment.
I encapsulated these styles into this generator, so they could be reused. Currently used on d2l-link and d2l-empty-state-action-link
| a span.truncate-one { | ||
| ${overflowEllipsisDeclarations} | ||
| } | ||
| #new-window { |
There was a problem hiding this comment.
These styles where moved to the new generator function _generateInlineLinkIconStyles.
| * REQUIRED: The action URL or URL fragment of the link | ||
| * @type {string} | ||
| */ | ||
| href: { type: String, required: true }, |
There was a problem hiding this comment.
This comes for free within the LinkMixin
| * REQUIRED: The action URL or URL fragment of the link | ||
| * @type {string} | ||
| */ | ||
| href: { type: String, required: true }, |
There was a problem hiding this comment.
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.
…since it is being used.
| : nothing; | ||
|
|
||
| return html`${actionLink}`; | ||
| if (!this.text || !this.href) return nothing; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I think normally we would just return;.
There was a problem hiding this comment.
Confirmed it is ok (things that can be returned).
There was a problem hiding this comment.
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>
|
🎉 This PR is included in version 3.320.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Jira
GAUD-10654
Description
There could be use-cases where we want that the
d2l-empty-state-action-linkopens the link, for example, on a new browser tabs. This is done by giving support to the HTMLtargetattribute that gets set in the shadow dom, on the anchor element.