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

Added title attribute #1043

Merged
merged 3 commits into from Nov 30, 2022
Merged

Added title attribute #1043

merged 3 commits into from Nov 30, 2022

Conversation

bunesk
Copy link
Contributor

@bunesk bunesk commented Nov 30, 2022

Fixes #1042

@vercel
Copy link

vercel bot commented Nov 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
shoelace ✅ Ready (Inspect) Visit Preview Nov 30, 2022 at 8:39PM (UTC)

Copy link
Member

@claviska claviska left a 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.

@@ -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. */
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright. Done.

@@ -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}
Copy link
Member

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.

Copy link
Contributor Author

@bunesk bunesk Nov 30, 2022

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.

Copy link
Member

@claviska claviska left a comment

Choose a reason for hiding this comment

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

Thanks!

@claviska claviska merged commit 35aa56d into shoelace-style:next Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting title to form controls doesn't work anymore
2 participants