-
Notifications
You must be signed in to change notification settings - Fork 800
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes scrollbar issue if upsell nudge is loaded in sidebar (#38170)
* Fixes scrollbar issue if upsell nudge is loaded in sidebar. * changelog * Update script import code
- Loading branch information
1 parent
0ac906f
commit 6675a6d
Showing
4 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
projects/packages/masterbar/changelog/fix-nav-classic-default--wp-admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Significance: patch | ||
Type: fixed | ||
|
||
Fixes scrollbar issue if upsell nudge is loaded in specific viewport. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
projects/packages/masterbar/src/admin-menu/wpcom-upsell-nudge-jitm-fix.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const wpcomFixSidebarScrolling = () => { | ||
const observer = new MutationObserver( mutationList => { | ||
mutationList.forEach( mutation => { | ||
mutation.addedNodes.forEach( node => { | ||
// The domain upsell nudge is added. | ||
if ( node.id === 'toplevel_page_site-notices' ) { | ||
window.dispatchEvent( new Event( 'resize' ) ); | ||
} | ||
} ); | ||
} ); | ||
} ); | ||
observer.observe( document.querySelector( '#adminmenu' ), { | ||
childList: true, | ||
} ); | ||
}; | ||
|
||
document.addEventListener( 'DOMContentLoaded', wpcomFixSidebarScrolling ); |