Skip to content

Commit 15d209b

Browse files
committed
fix: image flicker issue
1 parent 81eb0f5 commit 15d209b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/LiveDevelopment/BrowserScripts/RemoteFunctions.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2926,6 +2926,7 @@ function RemoteFunctions(config = {}) {
29262926

29272927
_attachEventHandlers: function() {
29282928
const ribbonContainer = this._shadow.querySelector('.phoenix-image-ribbon');
2929+
const ribbonStrip = this._shadow.querySelector('.phoenix-ribbon-strip');
29292930
const searchInput = this._shadow.querySelector('.phoenix-ribbon-search input');
29302931
const searchButton = this._shadow.querySelector('.phoenix-ribbon-search-btn');
29312932
const closeButton = this._shadow.querySelector('.phoenix-ribbon-close');
@@ -3021,6 +3022,13 @@ function RemoteFunctions(config = {}) {
30213022
});
30223023
}
30233024

3025+
// Restore original image when mouse leaves the entire ribbon strip
3026+
if (ribbonStrip) {
3027+
ribbonStrip.addEventListener('mouseleave', () => {
3028+
this.element.src = this._originalImageSrc;
3029+
});
3030+
}
3031+
30243032
// Prevent clicks anywhere inside the ribbon from bubbling up
30253033
if (ribbonContainer) {
30263034
ribbonContainer.addEventListener('click', (e) => {
@@ -3069,11 +3077,6 @@ function RemoteFunctions(config = {}) {
30693077
this.element.src = image.url || image.thumb_url;
30703078
});
30713079

3072-
// show original image when hover ends
3073-
thumbDiv.addEventListener('mouseleave', () => {
3074-
this.element.src = this._originalImageSrc;
3075-
});
3076-
30773080
// attribution overlay, we show this only in the image ribbon gallery
30783081
const attribution = window.document.createElement('div');
30793082
attribution.className = 'phoenix-ribbon-attribution';

0 commit comments

Comments
 (0)