Permalink
Browse files

feat(navbar): fixes BB-269: Prevent Dropdown from closing on ctrl+cli…

…ck (#226)

* Prevent Dropdown closing on click

* Some style revisions

* make keepMenuOpen to be able to be changed

* Make handleDropdownClick works correctly
  • Loading branch information...
TheFaR8 authored and MonkeyDo committed Nov 27, 2018
1 parent 80b7582 commit c946099b39bafe32081010755efd2115a2062439
Showing with 20 additions and 1 deletion.
  1. +20 −1 src/client/containers/layout.js
@@ -42,9 +42,25 @@ const {Alert, MenuItem, Nav, Navbar, NavItem, NavDropdown} = bootstrap;
class Layout extends React.Component {
constructor(props) {
super(props);
this.state = {};
this.state = {keepMenuOpen: false, menuOpen: false};
this.renderNavContent = this.renderNavContent.bind(this);
this.renderNavHeader = this.renderNavHeader.bind(this);
this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
this.handleDropdownClick = this.handleDropdownClick.bind(this);
}
handleDropdownToggle(newValue) {
if (this.state.keepMenuOpen) {
this.setState({keepMenuOpen: false, menuOpen: true});
}
else {
this.setState({menuOpen: newValue});
}
}
handleDropdownClick(eventKey, event) {
event.stopPropagation();
this.setState({keepMenuOpen: true}, this.handleDropdownToggle);
}
renderNavHeader() {
@@ -100,7 +116,10 @@ class Layout extends React.Component {
<NavDropdown
eventKey={1}
id="create-dropdown"
open={this.state.menuOpen}
title={createDropdownTitle}
onSelect={this.handleDropdownClick}
onToggle={this.handleDropdownToggle}
>
<MenuItem href="/work/create">
{genEntityIconHTMLElement('Work')}

0 comments on commit c946099

Please sign in to comment.