File tree Expand file tree Collapse file tree 5 files changed +78
-2
lines changed Expand file tree Collapse file tree 5 files changed +78
-2
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,10 @@ class Dialog extends Popup {
187187 return true ;
188188 }
189189
190+ get shouldHideBackdrop ( ) { // Required by Popup.js
191+ return false ;
192+ }
193+
190194 get _ariaLabelledBy ( ) { // Required by Popup.js
191195 return this . ariaLabel ? undefined : "ui5-popup-header" ;
192196 }
Original file line number Diff line number Diff line change @@ -106,6 +106,17 @@ const metadata = {
106106 type : Boolean ,
107107 } ,
108108
109+ /**
110+ * Defines whether the block layer will be shown if modal property is set to true.
111+ * @type {boolean }
112+ * @defaultvalue false
113+ * @public
114+ * @since 1.0.0-rc.10
115+ */
116+ hideBackdrop : {
117+ type : Boolean ,
118+ } ,
119+
109120 /**
110121 * Determines whether the <code>ui5-popover</code> arrow is hidden.
111122 *
@@ -620,6 +631,10 @@ class Popover extends Popup {
620631 return this . modal ;
621632 }
622633
634+ get shouldHideBackdrop ( ) { // Required by Popup.js
635+ return this . hideBackdrop ;
636+ }
637+
623638 get _ariaLabelledBy ( ) { // Required by Popup.js
624639 return this . ariaLabel ? undefined : "ui5-popup-header" ;
625640 }
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ const metadata = {
6767 * Defines the aria-label attribute for the popup
6868 *
6969 * @type {String }
70- * @defaultvalue : ""
70+ * @defaultvalue ""
7171 * @private
7272 * @since 1.0.0-rc.8
7373 */
@@ -313,7 +313,7 @@ class Popup extends UI5Element {
313313 return ;
314314 }
315315
316- if ( this . isModal ) {
316+ if ( this . isModal && ! this . shouldHideBackdrop ) {
317317 // create static area item ref for block layer
318318 this . getStaticAreaItemDomRef ( ) ;
319319 this . _blockLayerHidden = false ;
@@ -430,6 +430,15 @@ class Popup extends UI5Element {
430430 */
431431 get isModal ( ) { } // eslint-disable-line
432432
433+ /**
434+ * Implement this getter with relevant logic in order to hide the block layer (f.e. based on a public property)
435+ *
436+ * @protected
437+ * @abstract
438+ * @returns {boolean }
439+ */
440+ get shouldHideBackdrop ( ) { } // eslint-disable-line
441+
433442 /**
434443 * Return the ID of an element in the shadow DOM that is going to label this popup
435444 *
Original file line number Diff line number Diff line change 171171 </ div >
172172 </ ui5-popover >
173173
174+ < ui5-button id ="btnPopModalNoLayer "> Opens modal popover with no block layer!</ ui5-button >
175+
176+ < ui5-popover id ="modalPopoverNoLayer " modal header-text ="Modal popover " hide-backdrop >
177+ < ui5-list >
178+ < ui5-li > Hello</ ui5-li >
179+ < ui5-li > Again</ ui5-li >
180+ < ui5-li > Wooooooooooooooooooooooooooooorld</ ui5-li >
181+ </ ui5-list >
182+
183+ < div slot ="footer ">
184+ < ui5-button id ="modalPopoverNoLayerClose "> Close</ ui5-button >
185+ </ div >
186+ </ ui5-popover >
187+
174188 < ui5-button id ="btnPopFocus "> Opens popover with initial focus!</ ui5-button >
175189
176190 < ui5-popover id ="popFocus " initial-focus ="focusMe " header-text ="Popover header ">
374388 modalPopover . openBy ( btnPopModal ) ;
375389 } ) ;
376390
391+ btnPopModalNoLayer . addEventListener ( "click" , function ( ) {
392+ modalPopoverNoLayer . openBy ( btnPopModalNoLayer ) ;
393+ } ) ;
394+
395+ modalPopoverNoLayerClose . addEventListener ( "click" , function ( ) {
396+ modalPopoverNoLayer . close ( ) ;
397+ } ) ;
398+
377399 modalPopoverClose . addEventListener ( "click" , function ( event ) {
378400 modalPopover . close ( ) ;
379401 } ) ;
Original file line number Diff line number Diff line change @@ -137,6 +137,32 @@ describe("Popover general interaction", () => {
137137 assert . ok ( ! popover . isDisplayedInViewport ( ) , "Popover is closed." ) ;
138138 } ) ;
139139
140+ it ( "tests modal popover with no block layer" , ( ) => {
141+ const btnOpenPopover = $ ( "#btnPopModalNoLayer" ) ;
142+ const popover = $ ( "#modalPopoverNoLayer" ) ;
143+ const popoverId = popover . getProperty ( "_id" ) ;
144+
145+ btnOpenPopover . click ( ) ;
146+ assert . ok ( popover . getProperty ( "opened" ) , "Popover is opened." ) ;
147+
148+ const blockLayerIsCreated = browser . execute ( ( popoverId ) => {
149+ const staticAreaItems = document . querySelectorAll ( "ui5-static-area-item" ) ;
150+ let result = false ;
151+
152+ staticAreaItems . forEach ( item => {
153+ if ( item . shadowRoot . querySelector ( ".ui5-block-layer" ) && item . classList . contains ( popoverId ) ) {
154+ result = true ;
155+ }
156+ } ) ;
157+
158+ return result
159+ } , popoverId ) ;
160+
161+ assert . notOk ( blockLayerIsCreated , "Block layer is not created." ) ;
162+
163+ browser . keys ( "Escape" ) ;
164+ } ) ;
165+
140166 it ( "tests initial focus" , ( ) => {
141167 const focusedButton = $ ( "#focusMe" ) ;
142168 const btnOpenPopover = $ ( "#btnPopFocus" ) ;
You can’t perform that action at this time.
0 commit comments