fix(select-rich): add workaround invoker width when inside overlay

This commit is contained in:
qa46hx 2020-12-24 10:42:44 +01:00
parent 679d189ec4
commit 9b9db3dde4
3 changed files with 14 additions and 1 deletions

View file

@ -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

View file

@ -21,6 +21,7 @@ export class LionSelectInvoker extends LionButton {
#content-wrapper { #content-wrapper {
position: relative; position: relative;
pointer-events: none;
} }
`, `,
]; ];

View file

@ -388,7 +388,14 @@ export class LionSelectRich extends SlotMixin(ScopedElementsMixin(OverlayMixin(L
this._overlayCtrl.content.style.minWidth = 'auto'; this._overlayCtrl.content.style.minWidth = 'auto';
this._overlayCtrl.content.style.width = 'auto'; this._overlayCtrl.content.style.width = 'auto';
const contentWidth = this._overlayCtrl.content.getBoundingClientRect().width; 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.display = initContentDisplay;
this._overlayCtrl.content.style.minWidth = initContentMinWidth; this._overlayCtrl.content.style.minWidth = initContentMinWidth;
this._overlayCtrl.content.style.width = initContentWidth; this._overlayCtrl.content.style.width = initContentWidth;