File tree Expand file tree Collapse file tree 2 files changed +35
-3
lines changed
Expand file tree Collapse file tree 2 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { isTabPrevious } from "@ui5/webcomponents-base/dist/Keys.js";
88import { getNextZIndex , getFocusedElement , isFocusedElementWithinNode } from "@ui5/webcomponents-base/dist/util/PopupUtils.js" ;
99import PopupTemplate from "./generated/templates/PopupTemplate.lit.js" ;
1010import PopupBlockLayer from "./generated/templates/PopupBlockLayerTemplate.lit.js" ;
11- import { addOpenedPopup , removeOpenedPopup } from "./popup-utils/OpenedPopupsRegistry.js" ;
11+ import { getOpenedPopups , addOpenedPopup , removeOpenedPopup } from "./popup-utils/OpenedPopupsRegistry.js" ;
1212
1313// Styles
1414import styles from "./generated/themes/Popup.css.js" ;
@@ -236,7 +236,9 @@ class Popup extends UI5Element {
236236 * @protected
237237 */
238238 static blockBodyScrolling ( ) {
239- document . body . style . top = `-${ window . pageYOffset } px` ;
239+ if ( window . pageYOffset > 0 ) {
240+ document . body . style . top = `-${ window . pageYOffset } px` ;
241+ }
240242 document . body . classList . add ( "ui5-popup-scroll-blocker" ) ;
241243 }
242244
@@ -395,9 +397,12 @@ class Popup extends UI5Element {
395397 return ;
396398 }
397399
400+ const openedPopups = getOpenedPopups ( ) ;
398401 if ( this . isModal ) {
399402 this . _blockLayerHidden = true ;
400- Popup . unblockBodyScrolling ( ) ;
403+ if ( openedPopups . length === 1 ) {
404+ Popup . unblockBodyScrolling ( ) ;
405+ }
401406 }
402407
403408 this . hide ( ) ;
Original file line number Diff line number Diff line change @@ -166,3 +166,30 @@ describe("Acc", () => {
166166 assert . strictEqual ( dialog . shadow$ ( ".ui5-popup-root" ) . getAttribute ( "aria-label" ) , accName , "dialog has aria-label." ) ;
167167 } ) ;
168168} ) ;
169+
170+ describe ( "Multiple dialogs page scroll" , ( ) => {
171+ before ( ( ) => {
172+ browser . url ( `http://localhost:${ PORT } /test-resources/pages/Dialog.html` ) ;
173+ } ) ;
174+
175+ it ( "tests multiple dialogs page scrolling" , ( ) => {
176+ const preventButtonBefore = browser . $ ( "#prevent" ) ;
177+
178+ browser . setWindowSize ( 400 , 400 ) ;
179+ preventButtonBefore . scrollIntoView ( ) ;
180+
181+ const offsetBefore = preventButtonBefore . getLocation ( 'y' ) ;
182+
183+ preventButtonBefore . click ( ) ;
184+
185+ browser . keys ( "Escape" ) ;
186+ const confirmButton = browser . $ ( "#yes" ) ;
187+ confirmButton . click ( ) ;
188+
189+ browser . setTimeout ( { script : 5000 } ) ;
190+ const offsetAfter = preventButtonBefore . getLocation ( 'y' ) ;
191+
192+ assert . strictEqual ( offsetBefore , offsetAfter , "No vertical page scrolling when multiple dialogs are closed" ) ;
193+ } ) ;
194+
195+ } ) ;
You can’t perform that action at this time.
0 commit comments