Skip to content

Commit a68dfbb

Browse files
authoredOct 19, 2020
feat(framework): make getStableDomRef search in the static area item … (#2363)
1 parent ea47cd3 commit a68dfbb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed
 

‎packages/base/src/UI5Element.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,7 @@ class UI5Element extends HTMLElement {
548548

549549
if (this._shouldUpdateFragment()) {
550550
this.staticAreaItem._updateFragment(this);
551+
this.staticAreaItemDomRef = this.staticAreaItem.staticAreaItemDomRef.shadowRoot;
551552
}
552553

553554
// Safari requires that children get the slot attribute only after the slot tags have been rendered in the shadow DOM
@@ -638,12 +639,16 @@ class UI5Element extends HTMLElement {
638639
}
639640

640641
/**
641-
* Use this method in order to get a reference to element in the shadow root of a web component
642+
* Use this method in order to get a reference to an element in the shadow root of the web component or the static area item of the component
642643
* @public
644+
* @method
643645
* @param {String} refName Defines the name of the stable DOM ref
644646
*/
645647
getStableDomRef(refName) {
646-
return this.getDomRef().querySelector(`[data-ui5-stable=${refName}]`);
648+
const staticAreaResult = this.staticAreaItemDomRef && this.staticAreaItemDomRef.querySelector(`[data-ui5-stable=${refName}]`);
649+
650+
return staticAreaResult
651+
|| this.getDomRef().querySelector(`[data-ui5-stable=${refName}]`);
647652
}
648653

649654
/**

0 commit comments

Comments
 (0)
Please sign in to comment.