From 74b490049a765dfba8c09f57aeeeacc17f3a9ed6 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Tue, 16 Mar 2021 10:50:46 +0300 Subject: [PATCH] Refactor #1875 - For SplitButton --- src/components/splitbutton/SplitButton.js | 9 ++------- src/components/splitbutton/SplitButtonPanel.js | 7 +------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/components/splitbutton/SplitButton.js b/src/components/splitbutton/SplitButton.js index 4b68e2531e..fabc547df3 100644 --- a/src/components/splitbutton/SplitButton.js +++ b/src/components/splitbutton/SplitButton.js @@ -111,13 +111,8 @@ export class SplitButton extends Component { alignPanel() { const container = this.defaultButton.parentElement; - if (this.props.appendTo) { - this.overlayRef.current.style.minWidth = DomHandler.getWidth(container) + 'px'; - DomHandler.absolutePosition(this.overlayRef.current, container); - } - else { - DomHandler.relativePosition(this.overlayRef.current, container); - } + this.overlayRef.current.style.minWidth = DomHandler.getOuterWidth(container) + 'px'; + DomHandler.absolutePosition(this.overlayRef.current, container); } bindDocumentClickListener() { diff --git a/src/components/splitbutton/SplitButtonPanel.js b/src/components/splitbutton/SplitButtonPanel.js index 1f7543c003..d226e9d66a 100644 --- a/src/components/splitbutton/SplitButtonPanel.js +++ b/src/components/splitbutton/SplitButtonPanel.js @@ -40,12 +40,7 @@ class SplitButtonPanelComponent extends Component { render() { let element = this.renderElement(); - if (this.props.appendTo) { - return ReactDOM.createPortal(element, this.props.appendTo); - } - else { - return element; - } + return ReactDOM.createPortal(element, this.props.appendTo || document.body); } }