Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,17 @@ li {
font-size: 12px;
margin-bottom: 17px;
}

li strong {
margin-top: auto;
margin-left: auto;
margin-right: 10px;
}

li svg{
margin-top: auto;
margin-bottom: 2px;
}
.clickable {
cursor: pointer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const link = computed(() => `${props.link}&tags=${props.metricTag.toLowerCase()}
.rules-criticities {
width: 100%;
height: 100%;
border-left: 1px solid #f2f2f2;
padding-left: 25px;
padding-left: 10px;
}
</style>
30 changes: 15 additions & 15 deletions shared/vue-ui/src/molecules/TooltipBox/TooltipBox.stories.js
Comment thread
AMorgaut marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,28 @@ export default {
anchor: { control: { type: 'boolean' }, required: false, default: false },
default: { control: { type: 'text' }, required: true },
},
}

const Template = (args) => ({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

niptick: this template is not an exported story so it could be less confusing to define it before the WithAnchor story (Moreover, the WithAnchor story should use it too...)

components: { TooltipBox },
setup() {
return { args }
},
template: `

@AMorgaut AMorgaut Aug 29, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: The template still doesn't use the expected right HTML exemple

It should be:

{
  template: `
      <p>
        The
        <abbr>
          HTML
          <tooltip-box v-bind="args">{{ args.default }}</tooltip-box>
        </abbr>
        abbr element.
      </p>`
}

The current example is wrong because it doesn't highlight the difference between

  • the text holding the tooltip (here "HTML") which will react on mouse over,
  • and the other text on which there will be no interaction (here "The" and "abbr element.")

<p>
The
<abbr>
HTML
<tooltip-box v-bind="args">
</tooltip-box>
</abbr>
abbr element.
</p>
<p style='text-decoration: underline dashed 1px'>Mouse hover this text to display the tooltip content.</p>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: This style should not be in the story, it should be implemented by default by the tooltip component.

I guess it should be in the CSS rule :has(> div[role=tooltip]) and the div[role=tooltip] rule should clean it so the tooltip content is not underlined too

<tooltip-box v-bind="args">{{ args.default }}</tooltip-box>
`,
}
});

export const WithAnchor = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: this story should use the same template

args: {
anchor: true,
default: "Hyper Text Markup Language"
}
}

export const UseParentOnlyAsAnchor = {
args: {
default: "Hyper Text Markup Language"
},
export const UseParentOnlyAsAnchor = Template.bind({});

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

niptick: when we use the right example template without the anchor, there is no visual indication showing the "HTML" text in the <abbr /> element has an associated tooltip. The parent element of the tooltip component should probably have something like a dashed underline decoration which is a more commonly applied style to highlight content with alternate text such as tooltips.

UseParentOnlyAsAnchor.args = {
default: "Hyper Text Markup Language",
anchor: false,
}
74 changes: 60 additions & 14 deletions shared/vue-ui/src/molecules/TooltipBox/TooltipBox.vue

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: the tooltip content is not displayed aside the anchor

image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Same problem as above ... We got some render issues due to the storybook ...
It should work properly in real condition (example TagCard)

@AMorgaut AMorgaut Sep 1, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As I said we may handle it in a separated ticket
Moreover I don't think it is relevant to a use case with the anchor without associated text to attach it to

It is ok in the TagCard but probably because of a specific context

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

todo: it would be nice to add a TooltipBox.spec.js unit test file as the one we have for the AbcdeScore component. It would also help to pass the Sonar Gateway

Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@
*/
defineProps({
anchor: { type: Boolean, required: false, default: false },
position: { type: String, required: false, default: 'bottom',
validator(value) {
return ['top', 'top-left', 'top-right', 'left', 'right', 'bottom' ,'bottom-left', 'bottom-right'].includes(value)
}
},
});

</script>

<template>
<div
v-if="anchor"
class="anchor"
>
i
</div>
<div v-if="anchor" class="anchor">i</div>
<div class="main-anchor"></div>

<div
ref="refTooltip"
inert
role="tooltip"
:class="['pos', position.toLowerCase()]"
>
<slot />
</div>
Expand All @@ -32,16 +36,19 @@ defineProps({
background-color: #4aa9d5;
width: 13px;
height: 13px;
line-height: 13px;
color: white;
font-weight: 500;
font-size: smaller;
font-size: small;
float: right;
margin-left: 5px;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: the "i" in the anchor looks to not be well verticaly aligned in the blue disk, also the text is selectable and as not the right pointer cursor when we mouse the mouse on it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

margin-top: 3px;
cursor: help;
}

div[role=tooltip] {

--_p-inline: 1.5ch;
--_p-inline: 2.5ch;
--_p-block: .75ch;
--_triangle-size: 7px;
--_shadow-alpha: 50%;
Expand All @@ -62,26 +69,24 @@ div[role=tooltip] {

inline-size: max-content;

max-inline-size: 25ch;
max-inline-size: 50ch;

text-align: start;

font-size: 1rem;

font-weight: normal;
line-height: normal;
line-height: initial;

padding: var(--_p-block) var(--_p-inline);
margin: 0;
margin: 0px 5px 30px 5px;

border: 1px solid;
border-radius: 5px;

/* Use System Colors https://developer.mozilla.org/en-US/docs/Web/CSS/system-color */
color: CanvasText;
background-color: Canvas;

border: 1px solid

}

/* create a stacking context for elements with tooltips */
Expand All @@ -96,6 +101,47 @@ div[role=tooltip] {
transition-delay: 200ms;
}

/* Positionning tooltip around the main-anchor*/
.main-anchor {
anchor-name: --main-anchor;
}

.pos {
position-anchor: --main-anchor;
}

.top {
position-area: y-start;
}

.top-left {
position-area: y-start x-start;
}

.top-right {
position-area: y-start x-end;
}

.bottom {
position-area: y-end;
}

.bottom-left {
position-area: y-end x-start;
}

.bottom-right {
position-area: y-end x-end;
}

.left {
position-area: x-start;
}

.right {
position-area: x-end;
}

/* prepend some prose for screen readers only */
div[role="tooltip"]::before {
content: "; Has tooltip: ";
Expand Down
14 changes: 5 additions & 9 deletions shared/vue-ui/src/organisms/ScoreBlock/ScoreBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,9 @@ const projectLink = computed(() => {
<div class="tooltip-calc">
Comment thread
AMorgaut marked this conversation as resolved.
how my score is calculated ?
<tooltip-box>
<p>
<strong>{{ labelLong }} </strong><br>
{{ text }}
</p>
<br>
<p>
<strong>Identified issues in your app:</strong>
</p>
<strong>{{ labelLong }}</strong>
<br><br>
<strong>Identified issues in your app:</strong>
<rule-criticities

@AMorgaut AMorgaut Aug 20, 2025

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: The is no padding on the right.
The 0 values are stick to the border
image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

fixed

:minor-severities="minorSeverities"
:major-severities="majorSeverities"
Expand All @@ -67,7 +62,8 @@ const projectLink = computed(() => {
}
.tooltip-calc {
margin-top: 20px;
text-decoration: underline;
text-decoration: underline dashed 1px;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: this text-decoration style should be moved at the Tooltip component level. I guess it should be in the CSS rule :has(> div[role=tooltip])

@fsimba-dev fsimba-dev Sep 10, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

not easy to apply style to component caller (here the <div> in the score block)...
That's why I putted the in the caller component( score block)

display: inline-block;
cursor: help;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: this cursor style should be moved at the Tooltip component level. I guess it should be in the CSS rule :has(> div[role=tooltip])

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

not easy to apply style to component caller (here the <div> in the score block)...
Thats why I putted the in the caller component( score block)

}
</style>
21 changes: 9 additions & 12 deletions shared/vue-ui/src/organisms/TagCard/TagCard.vue

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

issue: the anchor should be upper than its target text. we can also see on this capture the positionning issue of the "i" in the the blue disc

image

You can refer to the visual reference there in the TagCard feature request: #91

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this issue fixed?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes the position of the letter 'i' was centered ...
For the tooltip position we can pass it through the component props (top, bottom, left, ...) ...
The default position is bottom

Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@ const projectLink = computed(() => {
<template>
<div class="tag-card">
<div class="head">
<div>
<div class="title">
<strong>{{ props.metricTag }}</strong>
</div>
<div>
<tooltip-box anchor>
Affected rules correspond to the number of rules associated with
errors identified by SonarQube, among the Greensight rules that
impact this component
</tooltip-box>
</div>
<div class="title">
<strong>{{ props.metricTag }}</strong>
<tooltip-box anchor>
Affected rules correspond to the number of rules associated with
errors identified by SonarQube, among the Greensight rules that
impact this component
</tooltip-box>
</div>
<a
v-if="!noIssues"
Expand Down Expand Up @@ -106,8 +102,9 @@ const projectLink = computed(() => {
.title {
float: left;
margin-left: 5px;
}
.title strong {
font-size: 18px;
height: 10px;
}
.body {
display: flex;
Expand Down