Skip to content
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

Boost: Fix performance history tooltip #39879

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Fixed tooltip behavior
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ $white: #ffffff;
.jb-score-tooltips-container {
width: 100%;
position: relative;
pointer-events: none;

}

.jb-score-tooltip-react-root {
position: absolute;
bottom: -20px;
translate: -50% calc( 100% - 20px );
z-index: 1000;
pointer-events: auto;
}

.jb-score-tooltip {
Expand All @@ -17,6 +27,11 @@ $white: #ffffff;
width: 20em;
position: relative;
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
display: none;

.visible &, &:hover {
display: block;
}

hr {
border-top: 1px solid $grey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,26 @@ export function tooltipsPlugin( periods ) {
if ( ! reactDom ) {
reactDom = ReactDOM.createRoot( reactRoot );
}
reactRoot.style.position = 'absolute';
reactRoot.style.bottom = -20 + 'px';
reactRoot.style.translate = '-50% calc( 100% - 20px )';
reactRoot.style.zIndex = '1000';
reactRoot.classList.add( 'jb-score-tooltip-react-root' );

container.appendChild( reactRoot );

u.over.appendChild( container );

/**
* Hides all tooltips.
*/
function hideTips() {
reactRoot.style.display = 'none';
}
u.over.addEventListener( 'mouseenter', () => {
container.classList.add( 'visible' );
} );

/**
* Shows all tooltips.
*/
function showTips() {
reactRoot.style.display = null;
}
u.over.addEventListener( 'mouseleave', () => {
container.classList.remove( 'visible' );
} );

container.addEventListener( 'mouseleave', () => {
hideTips();
reactRoot.addEventListener( 'mouseenter', () => {
reactRoot.classList.add( 'visible' );
} );

container.addEventListener( 'mouseenter', () => {
showTips();
reactRoot.addEventListener( 'mouseleave', () => {
reactRoot.classList.remove( 'visible' );
} );
}

Expand All @@ -62,7 +53,7 @@ export function tooltipsPlugin( periods ) {
* @param {uPlot} u - The uPlot instance.
*/
function setSize( u: uPlot ) {
container.style.height = u.over.clientHeight + 'px';
container.style.paddingTop = u.over.clientHeight + 'px';
}

/**
Expand All @@ -75,6 +66,10 @@ export function tooltipsPlugin( periods ) {

const period = periods[ idx ];

if ( ! period ) {
return;
}

// Timestamp of the cursor position
const timestamp = u.data[ 0 ][ idx ];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Performance History: Fixed tooltip behavior
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other


Loading