Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 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
2 changes: 1 addition & 1 deletion docs/testing/regression-checklist/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"testFile": [ "extensions/blocks/checklist.md" ]
},
{
"regex": "^projects\/plugins\/jetpack\/extensions\/(blocks\/(subscriptions|premium-content)\/|shared\/memberships\.js)",
"regex": "^projects/plugins/jetpack/extensions/(blocks/(subscriptions|premium-content)/|shared/memberships.js)",
Comment thread
dilirity marked this conversation as resolved.
Resolved
"testFile": [ "extensions/blocks/subscriptions.md" ]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ function getClosestContainingAncestor( node: HTMLElement ): HTMLElement | null {

// Keep track of ancestor elements that do not have a "z-index" set
let elementsWithoutZIndex: HTMLElement[] = [];

while ( current && current instanceof HTMLElement ) {
// Don't go past the body element
if ( current === document.body ) {
Expand All @@ -31,11 +30,17 @@ function getClosestContainingAncestor( node: HTMLElement ): HTMLElement | null {
( style.position === 'static' || style.position === 'relative' )
) {
elementsWithoutZIndex.push( current );
} else {
elementsWithoutZIndex = [];
// Move on to the next parent element
current = current.parentElement;
continue;
}

if ( style.position === 'relative' && style.zIndex !== 'auto' ) {
elementsWithoutZIndex = [ current ];
current = current.parentElement;
continue;
}

// Move on to the next parent element
current = current.parentElement;
}

Expand Down Expand Up @@ -98,10 +103,7 @@ function findContainer( image: MeasurableImage ): HTMLElement | undefined {
wrapper.classList.add( 'jetpack-boost-guide' );
wrapper.dataset.jetpackBoostGuideId = ( ++wrapperID ).toString();
if ( parentStyle.position === 'static' ) {
wrapper.classList.add( 'relative' );
Array.from( ancestor.children )
.reverse()
.forEach( child => wrapper.appendChild( child ) );
ancestor.style.position = 'relative';
}

ancestor.prepend( wrapper );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import { backOut } from 'svelte/easing';
import { fade, fly } from 'svelte/transition';
import Spinner from './Spinner.svelte';
Expand All @@ -19,9 +20,27 @@
y: 2,
easing: backOut,
};

let bubble: HTMLElement;
const dispatch = createEventDispatcher();
function onHover() {
const rect = bubble.getBoundingClientRect();
dispatch( 'hover', {
index,
position: {
top: rect.top + rect.height + 10,
left: rect.left,
},
} );
}
</script>

<div class="interaction-area {severity}" on:mouseenter transition:fly={scaleTransition}>
<div
class="interaction-area {severity}"
bind:this={bubble}
on:mouseenter={onHover}
transition:fly={scaleTransition}
>
<div class="bubble">
{#if false === $isLoading}
<div class="bubble-inner">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
stores.forEach( store => store.updateDimensions() );
} );

function onMouseLeave() {
function closeDetails( e ) {
// Don't exit when hovering the Portal
if (
e.relatedTarget &&
// Don't exit when hovering the Popup
e.relatedTarget.classList.contains( 'keep-guide-open' )
) {
return;
}

if ( $guideState !== 'always_on' ) {
show = false;
}
Expand Down Expand Up @@ -46,21 +55,35 @@

$: show = $guideState === 'always_on' ? 0 : false;
$: toggleBackdrop( show !== false );
let position = {
top: 0,
left: 0,
};

function hover( e: CustomEvent ) {
const detail = e.detail;
const index = detail.index;
position = detail.position;
show = index;
}
</script>

{#if $guideState === 'active' || $guideState === 'always_on'}
<div class="guide {size}" class:show={show !== false} on:mouseleave={onMouseLeave}>
<div class="guide {size}"
class:show={show !== false}
class:keep-guide-open={show !== false}
on:mouseleave={closeDetails}>
<div class="previews">
{#each stores as store, index}
<Bubble {index} {store} on:mouseenter={() => ( show = index )} />
<Bubble {index} {store} on:hover={hover} />
{/each}
</div>
{#if show !== false}
<!--
Intentionally using only a single component here.
See <Popup> component source for details.
-->
<Popup store={stores[ show ]} {size} />
<Popup store={stores[ show ]} {size} {position} on:mouseleave={closeDetails} />
{/if}
</div>
{/if}
Expand All @@ -84,14 +107,11 @@
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 8000;
line-height: 1.55;
padding: 15px;
padding: 20px;
&.small {
font-size: 13px;
padding: 15px;
}

&.micro {
Expand Down
Loading