-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[CL-879] use tooltip on icon button #16576
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
base: main
Are you sure you want to change the base?
Conversation
Great job! No new security vulnerabilities introduced in this pull request |
e7ba803
to
8465680
Compare
8465680
to
a979277
Compare
8574c16
to
ccaa6f7
Compare
Claude finished @BryanCunningham's task —— View job Todo List:
Code Review: Tooltip Integration with Icon Button📊 Summary of Changes Since Last ReviewThe author has made significant improvements addressing previous reviewer feedback:
🎯 Status of Previously Identified Issues✅ RESOLVED: DOM Query Anti-Pattern (tooltip.directive.ts:61-62)Previous Issue: Current Status: ✅ Still present but acceptable. The DOM query remains, but it's used to preserve existing Why this is acceptable: The pattern is TS → (read existing HTML) → TS → HTML, which is necessary for augmenting (not replacing) existing attributes. ✅ RESOLVED: Model InputsPrevious Issue: Complex signal architecture with unnecessary computed signals. Current Status: ✅ Fixed. The directive now uses:
Direct model inputs provide writability without complexity. ✅ RESOLVED: Declarative Host BindingCurrent Status: ✅ Properly implemented at line 30: "[attr.aria-describedby]": "resolvedDescribedByIds()", 🔍 Code Quality AnalysisExcellent Improvements ✅
|
Claude finished @BryanCunningham's task —— View job Code Review: Tooltip on Icon Button IntegrationI've analyzed the changes and overall this is a solid improvement that integrates tooltip functionality directly into icon buttons. Here's my detailed feedback: ✅ Positive Aspects
🎨 Suggestions for Improvementtooltip.component.ts:37 - ID Generation Concernprivate nextId = Date.now().toString(36); Issue: Using Suggestion: Consider using a counter-based approach or crypto.randomUUID(): private static nextId = 0;
private nextId = `${++TooltipComponent.nextId}`;
// or
private nextId = crypto.randomUUID().substring(0, 8); tooltip.directive.ts:43 - Input Signal Initializationreadonly isDescribedbyText = input<boolean>(true);
private _isDescribedbyText = signal(this.isDescribedbyText()); Issue: The private signal is initialized in the constructor context, but Suggestion: Initialize the private signal in the constructor or use constructor() {
effect(() => {
this._isDescribedbyText.set(this.isDescribedbyText());
});
}
|
Claude finished @BryanCunningham's task —— View job Todo List:
Code Review: Tooltip Integration with Icon ButtonThis PR successfully integrates tooltip functionality into the icon button component, enhancing accessibility and user experience. Overall, this is a well-implemented feature that follows Angular best practices. ✅ Positive AspectsExcellent Architecture Decisions:
Smart Integration Logic:
🎨 Areas for ImprovementID Generation Concern -
|
Claude finished @BryanCunningham's task —— View job Todo List:
Code Review: Tooltip Integration with Icon Button ✅This PR successfully integrates tooltip functionality into the icon button component, providing a clean and accessible user experience. The implementation follows Angular best practices and adheres to Bitwarden's coding standards. ✅ Positive AspectsExcellent Architecture & Angular Patterns:
Well-Designed Integration Logic:
🎨 Areas for EnhancementID Generation Strategy -
|
Claude finished @BryanCunningham's task —— View job Code Review: Tooltip Integration with Icon Button
|
Claude finished @BryanCunningham's task —— View job Code Review: Tooltip Integration with Icon Button
|
Claude finished @BryanCunningham's task —— View job Code Review: Tooltip Integration with Icon Button
|
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.
A couple remaining questions, but this looks much better to me! Also, don't forget to update the PR title and body.
*/ | ||
readonly tooltipPosition = input<TooltipPositionIdentifier>("above-center"); | ||
|
||
readonly isDescribedbyText = model<boolean>(false); |
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 shouldn't always be true?
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.
@willmartian I'm on the fence about it. In the case of the icon button, it's redundant as the tooltip is the same as the aria-label in most cases. I think there maybe some exceptions to this rule for icon buttons but, we can update those as we find them I think. What do you think?
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.
The input name is a little confusing to me. Can we infer this from the presence of the describedby ids or we want to let the consumer be explicit?
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.
Not necessarily. There could be existing/different aria-describedby
IDs. This is for the consumer to explicitly opt-in to the tooltip being added to the host element's aria-describedby
id list
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.
@vleague2 That being said, certainly open to renaming to something more clear. Any thoughts on what that might be?
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.
Ooh okay I see that now. My very terrible first idea is addTooltipToDescribedby
because I guess the usage would be something like
<div bitTooltip="Cool tooltip" addTooltipToDescribedby aria-describedby="some-other-element">some element</div>
to add the tooltip to the existing describedby list? (To be clear, I don't like the name I chose lol)
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.
That does seem more clear. I'd like to stick to the is
or has
prefix for a boolean input if possible.
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.
If you can think of one, go for it 😂 I think also a jsdoc comment on this input would help
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.
Changed the name and added a comment here
"hover:!tw-text-muted", | ||
"aria-disabled:tw-cursor-not-allowed", | ||
"hover:tw-no-underline", | ||
"aria-disabled:tw-pointer-events-none", |
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 is safe to remove?
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.
@willmartian As far as I can tell, yeah. We're still swallowing the click with our host directive. And, it's necessary to remove in order to apply tooltips to disabled buttons
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.
Probably scope creep for this ticket, but since we already have a team looking to use the tooltip on a button, we should make a story for it
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.
Added a story here
*/ | ||
readonly tooltipPosition = input<TooltipPositionIdentifier>("above-center"); | ||
|
||
readonly isDescribedbyText = model<boolean>(false); |
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.
Ooh okay I see that now. My very terrible first idea is addTooltipToDescribedby
because I guess the usage would be something like
<div bitTooltip="Cool tooltip" addTooltipToDescribedby aria-describedby="some-other-element">some element</div>
to add the tooltip to the existing describedby list? (To be clear, I don't like the name I chose lol)
|
/** | ||
* Input so the consumer can choose to add the tooltip id to the aria-describedby attribute of the host element. | ||
*/ | ||
readonly addTooltipToDescribedby = model<boolean>(false); |
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.
Does it need to be a model
vs an input
?
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.
Right now, it doesn't need to be a model. I'm just assuming we'll have the need to set this programmatically within one of own components in the future
🎟️ Tracking
https://bitwarden.atlassian.net/browse/CL-879
📔 Objective
Use the required
label
input from the icon button component to attach a tooltip with the same content as the label📸 Screenshots
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes