Skip to content

Commit

Permalink
Merge pull request react-bootstrap#755 from bbc/dropdown-close-ie8-fix
Browse files Browse the repository at this point in the history
[changed] Fix button dropdown not closing when clicking button on IE8
  • Loading branch information
mtscout6 committed Jun 1, 2015
2 parents 2473fae + 0cfbf3b commit fc378de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/DropdownStateMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const DropdownStateMixin = {
handleDocumentClick(e) {
// If the click originated from within this component
// don't do anything.
if (isNodeInRoot(e.target, React.findDOMNode(this))) {
// e.srcElement is required for IE8 as e.target is undefined
let target = e.target || e.srcElement;
if (isNodeInRoot(target, React.findDOMNode(this))) {
return;
}

Expand Down
4 changes: 3 additions & 1 deletion src/RootCloseWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export default class RootCloseWrapper extends React.Component {

handleDocumentClick(e) {
// If the click originated from within this component, don't do anything.
if (isNodeInRoot(e.target, React.findDOMNode(this))) {
// e.srcElement is required for IE8 as e.target is undefined
let target = e.target || e.srcElement;
if (isNodeInRoot(target, React.findDOMNode(this))) {
return;
}

Expand Down

0 comments on commit fc378de

Please sign in to comment.