Skip to content

Commit

Permalink
Refactor #1878 - For SplitButton
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Mar 16, 2021
1 parent f106072 commit 0a63483
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/components/splitbutton/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class SplitButton extends Component {
this.onOverlayEnter = this.onOverlayEnter.bind(this);
this.onOverlayEntered = this.onOverlayEntered.bind(this);
this.onOverlayExit = this.onOverlayExit.bind(this);
this.onOverlayExited = this.onOverlayExited.bind(this);
this.onPanelClick = this.onPanelClick.bind(this);

this.id = this.props.id || UniqueComponentId();
Expand Down Expand Up @@ -109,6 +110,10 @@ export class SplitButton extends Component {
this.unbindResizeListener();
}

onOverlayExited() {
DomHandler.revertZIndex();
}

alignPanel() {
const container = this.defaultButton.parentElement;
this.overlayRef.current.style.minWidth = DomHandler.getOuterWidth(container) + 'px';
Expand Down Expand Up @@ -235,7 +240,7 @@ export class SplitButton extends Component {
aria-expanded={this.state.overlayVisible} aria-haspopup aria-owns={this.id + '_overlay'} />
<SplitButtonPanel ref={this.overlayRef} appendTo={this.props.appendTo} id={this.id + '_overlay'}
menuStyle={this.props.menuStyle} menuClassName={this.props.menuClassName} onClick={this.onPanelClick}
in={this.state.overlayVisible} onEnter={this.onOverlayEnter} onEntered={this.onOverlayEntered} onExit={this.onOverlayExit}>
in={this.state.overlayVisible} onEnter={this.onOverlayEnter} onEntered={this.onOverlayEntered} onExit={this.onOverlayExit} onExited={this.onOverlayExited}>
{items}
</SplitButtonPanel>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/splitbutton/SplitButtonPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SplitButtonPanelComponent extends Component {

return (
<CSSTransition nodeRef={this.props.forwardRef} classNames="p-connected-overlay" in={this.props.in} timeout={{ enter: 120, exit: 100 }}
unmountOnExit onEnter={this.props.onEnter} onEntered={this.props.onEntered} onExit={this.props.onExit}>
unmountOnExit onEnter={this.props.onEnter} onEntered={this.props.onEntered} onExit={this.props.onExit} onExited={this.props.onExited}>
<div ref={this.props.forwardRef} className={className} style={this.props.menuStyle} id={this.props.id} onClick={this.onClick}>
<ul className="p-menu-list p-reset" role="menu">
{this.props.children}
Expand Down

0 comments on commit 0a63483

Please sign in to comment.