Skip to content

Commit

Permalink
fix(popover): remove universal overwrite of anchor onKeyDown
Browse files Browse the repository at this point in the history
  • Loading branch information
bfbiggs committed Jul 29, 2020
1 parent a5b9234 commit 5f4afe1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions react/src/lib/Popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ class Popover extends React.Component {
const { isOpen } = this.state;
const { autoFocusOnFirstElt } = this.props;

if (autoFocusOnFirstElt && isOpen && !prevState.isOpen && this.overlay) {
if (autoFocusOnFirstElt
&& isOpen
&& !prevState.isOpen
&& this.overlay
) {
const eventOverlay = ReactDOM.findDOMNode(this.overlay);

if (eventOverlay) {
Expand Down Expand Up @@ -277,7 +281,10 @@ class Popover extends React.Component {

triggerProps.onFocus = includeFocusOnHover ? this.handleFocus : undefined;
triggerProps.onBlur = includeFocusOnHover ? this.handleBlur : undefined;
triggerProps.onKeyDown = includeFocusOnHover ? undefined : this.handleKeyDownTrigger;
if(!includeFocusOnHover) {
triggerProps.onKeyDown = this.handleKeyDownTrigger;
}

break;

case 'Click':
Expand Down

0 comments on commit 5f4afe1

Please sign in to comment.