File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed
packages/dialtone-vue/components Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 1616 :header-class =" headerClass"
1717 :footer-class =" footerClass"
1818 :append-to =" appendTo"
19+ :external-anchor-element =" externalAnchorElement"
1920 data-qa =" dt-hovercard"
2021 :enter-delay =" enterDelay"
2122 :leave-delay =" leaveDelay"
@@ -203,6 +204,15 @@ const props = defineProps({
203204 type: Number ,
204205 default: TOOLTIP_DELAY_MS ,
205206 },
207+
208+ /**
209+ * External anchor element reference. Use this instead of the anchor slot when
210+ * the anchor may be inside a Shadow DOM, as querySelector cannot pierce shadow boundaries.
211+ */
212+ externalAnchorElement: {
213+ type: HTMLElement ,
214+ default: null ,
215+ },
206216});
207217
208218defineEmits ([
Original file line number Diff line number Diff line change @@ -281,12 +281,22 @@ export default {
281281 /**
282282 * External anchor id to use in those cases the anchor can't be provided via the slot.
283283 * For instance, using the combobox's input as the anchor for the popover.
284+ * @deprecated Use externalAnchorElement instead for Shadow DOM compatibility.
284285 */
285286 externalAnchor: {
286287 type: String ,
287288 default: ' ' ,
288289 },
289290
291+ /**
292+ * External anchor element reference. Use this instead of externalAnchor when
293+ * the anchor may be inside a Shadow DOM, as querySelector cannot pierce shadow boundaries.
294+ */
295+ externalAnchorElement: {
296+ type: HTMLElement ,
297+ default: null ,
298+ },
299+
290300 /**
291301 * The id of the tooltip
292302 */
@@ -642,6 +652,10 @@ export default {
642652 });
643653 },
644654
655+ externalAnchorElement () {
656+ this .updateAnchorEl ();
657+ },
658+
645659 placement (placement ) {
646660 this .tip ? .setProps ({
647661 placement,
@@ -718,9 +732,10 @@ export default {
718732 },
719733
720734 updateAnchorEl () {
721- const externalAnchorEl = this .externalAnchor
722- ? this .$refs .anchor .getRootNode ().querySelector (` #${ this .externalAnchor } ` )
723- : null ;
735+ const externalAnchorEl = this .externalAnchorElement ||
736+ (this .externalAnchor
737+ ? this .$refs .anchor .getRootNode ().querySelector (` #${ this .externalAnchor } ` )
738+ : null );
724739 const anchorEl = externalAnchorEl ?? this .$refs .anchor .children [0 ];
725740 if (anchorEl === this .anchorEl ) {
726741 return ;
You can’t perform that action at this time.
0 commit comments