diff --git a/.changeset/angry-snails-repeat.md b/.changeset/angry-snails-repeat.md new file mode 100644 index 000000000..a48a0a08b --- /dev/null +++ b/.changeset/angry-snails-repeat.md @@ -0,0 +1,5 @@ +--- +'@lion/select-rich': patch +--- + +add workarround and todo for align select-rich invoker width with options if its inside an overlay diff --git a/packages/select-rich/src/LionSelectInvoker.js b/packages/select-rich/src/LionSelectInvoker.js index 6987f27a5..bb447d027 100644 --- a/packages/select-rich/src/LionSelectInvoker.js +++ b/packages/select-rich/src/LionSelectInvoker.js @@ -21,6 +21,7 @@ export class LionSelectInvoker extends LionButton { #content-wrapper { position: relative; + pointer-events: none; } `, ]; diff --git a/packages/select-rich/src/LionSelectRich.js b/packages/select-rich/src/LionSelectRich.js index 83e0b1624..1b126b5e6 100644 --- a/packages/select-rich/src/LionSelectRich.js +++ b/packages/select-rich/src/LionSelectRich.js @@ -388,7 +388,14 @@ export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(L this._overlayCtrl.content.style.minWidth = 'auto'; this._overlayCtrl.content.style.width = 'auto'; const contentWidth = this._overlayCtrl.content.getBoundingClientRect().width; - this._invokerNode.style.width = `${contentWidth + this._arrowWidth}px`; + /** + * TODO when inside an overlay the current solution doesn't work. + * Since that dialog is still hidden, open and close the select-rich + * doesn't have any effect so the contentWidth returns 0 + */ + if (contentWidth > 0) { + this._invokerNode.style.width = `${contentWidth + this._arrowWidth}px`; + } this._overlayCtrl.content.style.display = initContentDisplay; this._overlayCtrl.content.style.minWidth = initContentMinWidth; this._overlayCtrl.content.style.width = initContentWidth;