Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Would an equivalent change be to just remove the
v-bind=“$attrs”
on the root element since they are essentially bound by default?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.
Nope, just removing the
v-bind=“$attrs”
still triggers the warning because the<slot />
is still wrapped by a<template />
Although we can also change the
to
to suppress the warning but it will introduce an extra wrapper to the slot, and the
$attrs
will bind to the div wrapper even for the "no-text-to-show" scenario in the tooltipPersonally, I want to avoid this behavior. I'd prefer to treat the
<KToolip />
as a conditional wrapper, when the text is provided, it wraps the children and renders a popover when hovered. But if there's no text to show, it should render the children directly without any wrap. And this is the current behavior.Please let me know if you think the "always wrap" behavior is better, cc @Leopoldthecoder since he introduced the conditional render logic here
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.
I can provide some context: this fix is mainly about getting rid of the console warning.
KCopy
bindsclass
anddata-testid
toKTooltip
, which confuses Vue because KTooltip's root node is conditionally rendered.