-
Notifications
You must be signed in to change notification settings - Fork 7
fix: tooltip rendering #122
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?
Changes from 2 commits
e6ffee8
692fe33
93aca9b
fb68549
8b5c250
07998ad
ca35475
033d4b3
089bdd3
d232b37
80d7765
2456631
4b4067f
5b7bb53
10f9fc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,28 +9,28 @@ export default { | |
| anchor: { control: { type: 'boolean' }, required: false, default: false }, | ||
| default: { control: { type: 'text' }, required: true }, | ||
| }, | ||
| } | ||
|
|
||
| const Template = (args) => ({ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| components: { TooltipBox }, | ||
| setup() { | ||
| return { args } | ||
| }, | ||
| template: ` | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
|
||
| <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> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| <tooltip-box v-bind="args">{{ args.default }}</tooltip-box> | ||
| `, | ||
| } | ||
| }); | ||
|
|
||
| export const WithAnchor = { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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({}); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| UseParentOnlyAsAnchor.args = { | ||
| default: "Hyper Text Markup Language", | ||
| anchor: false, | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ...
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I said we may handle it in a separated ticket It is ok in the TagCard but probably because of a specific context
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. todo: it would be nice to add a |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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> | ||
|
|
@@ -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; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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%; | ||
|
|
@@ -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 */ | ||
|
|
@@ -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: "; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,14 +42,9 @@ const projectLink = computed(() => { | |
| <div class="tooltip-calc"> | ||
|
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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
| :minor-severities="minorSeverities" | ||
| :major-severities="majorSeverities" | ||
|
|
@@ -67,7 +62,8 @@ const projectLink = computed(() => { | |
| } | ||
| .tooltip-calc { | ||
| margin-top: 20px; | ||
| text-decoration: underline; | ||
| text-decoration: underline dashed 1px; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: this
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not easy to apply style to component caller (here the |
||
| display: inline-block; | ||
| cursor: help; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue: this
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not easy to apply style to component caller (here the |
||
| } | ||
| </style> | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
You can refer to the visual reference there in the TagCard feature request: #91
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this issue fixed?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes the position of the letter 'i' was centered ... |



Uh oh!
There was an error while loading. Please reload this page.