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
Added title attribute #1043
Added title attribute #1043
Conversation
* also some other tests
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, especially for adding tests! I left a couple comments but otherwise this looks OK to merge.
src/components/button/button.ts
Outdated
@@ -98,6 +98,9 @@ export default class SlButton extends ShoelaceElement implements ShoelaceFormCon | |||
/** An optional value for the button. Ignored when `href` is set. */ | |||
@property() value = ''; | |||
|
|||
/** The button's title attribute. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't obvious, but the docs will ignore properties that don't have JSDoc comments like /**
. We probably don't want to document this, since it's a global attribute. Instead, let's move these up closer to the private properties and change the comment so we know why we're adding them, e.g.
@property() title = ''; // make reactive to pass through
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright. Done.
src/components/button/button.ts
Outdated
@@ -255,7 +258,7 @@ export default class SlButton extends ShoelaceElement implements ShoelaceFormCon | |||
})} | |||
?disabled=${ifDefined(isLink ? undefined : this.disabled)} | |||
type=${ifDefined(isLink ? undefined : this.type)} | |||
title=${'' /* An empty title prevents browser validation tooltips from appearing on hover */} | |||
title=${this.title} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we preserve the comment? This will let folks know why we're setting a global attribute and help prevent regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right. I preserved the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixes #1042