1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-06 06:07:33 +02:00

Merge pull request #172 from tarciozemel/master

feat(tooltip): improve UX with pointer-events management
This commit is contained in:
phuoc-ng
2021-04-02 20:07:18 +07:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@@ -47,16 +47,20 @@ css={`
position: relative;
}
/* Show the arrow and content when hovering the trigger element */
/* Show the arrow and content and restore pointer events when hovering the trigger element */
.container:hover .container__arrow,
.container:hover .container__content {
opacity: 1;
pointer-events: initial;
}
.container__arrow {
/* Invisible by default */
opacity: 0;
/* To prevent accidental interactions with other elements */
pointer-events: none;
/* Border */
border: 8px solid transparent;
border-top-color: #00439e;
@@ -79,6 +83,9 @@ css={`
/* Invisible by default */
opacity: 0;
/* To prevent accidental interactions with other elements */
pointer-events: none;
/* Background color, must be the same as the border color of arrow */
background-color: #00439e;
border-radius: 2px;

View File

@@ -9,6 +9,7 @@
.p-tooltip:hover .p-tooltip-arrow,
.p-tooltip:hover .p-tooltip-content {
opacity: 1;
pointer-events: initial;
}
.p-tooltip-arrow {
border: 8px solid transparent;
@@ -17,6 +18,7 @@
height: 0;
left: 50%;
opacity: 0;
pointer-events: none;
position: absolute;
transform: translate(-50%, 8px);
width: 0;
@@ -28,6 +30,7 @@
bottom: 100%;
left: 50%;
opacity: 0;
pointer-events: none;
position: absolute;
transform: translate(-50%, -8px);
z-index: 10;