Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-popover): implement hide-block-layer property #2413

Merged
merged 5 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions packages/main/src/Dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ class Dialog extends Popup {
return true;
}

get shouldHideBlockLayer() { // Required by Popup.js
return false;
}

get _ariaLabelledBy() { // Required by Popup.js
return this.ariaLabel ? undefined : "ui5-popup-header";
}
Expand Down
15 changes: 15 additions & 0 deletions packages/main/src/Popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ const metadata = {
type: Boolean,
},

/**
* Defines whether the block layer will be shown if modal property is set to true.
* @type {Boolean}
fifoosid marked this conversation as resolved.
Show resolved Hide resolved
* @defaultvalue false
* @public
* @since 1.0.0-rc.10
*/
hideBlockLayer: {
type: Boolean,
},

/**
* Determines whether the <code>ui5-popover</code> arrow is hidden.
*
Expand Down Expand Up @@ -620,6 +631,10 @@ class Popover extends Popup {
return this.modal;
}

get shouldHideBlockLayer() { // Required by Popup.js
return this.hideBlockLayer;
}

get _ariaLabelledBy() { // Required by Popup.js
return this.ariaLabel ? undefined : "ui5-popup-header";
}
Expand Down
13 changes: 11 additions & 2 deletions packages/main/src/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const metadata = {
* Defines the aria-label attribute for the popup
*
* @type {String}
* @defaultvalue: ""
* @defaultvalue ""
* @private
* @since 1.0.0-rc.8
*/
Expand Down Expand Up @@ -308,7 +308,7 @@ class Popup extends UI5Element {
return;
}

if (this.isModal) {
if (this.isModal && !this.hideBlockLayer) {
// create static area item ref for block layer
this.getStaticAreaItemDomRef();
this._blockLayerHidden = false;
Expand Down Expand Up @@ -425,6 +425,15 @@ class Popup extends UI5Element {
*/
get isModal() {} // eslint-disable-line

/**
* Implement this getter with relevant logic in order to hide the block layer (f.e. based on a public property)
*
* @protected
* @abstract
* @returns {boolean}
*/
get shouldHideBlockLayer() {} // eslint-disable-line

/**
* Return the ID of an element in the shadow DOM that is going to label this popup
*
Expand Down