Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Commit c38c758

Browse files
committed
Fix lint errors, and downgraded wp/viewport, as it broke the build
1 parent 21e1a4d commit c38c758

File tree

6 files changed

+854
-795
lines changed

6 files changed

+854
-795
lines changed

client/inbox-panel/card.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class InboxNoteCard extends Component {
3232
this.openDismissModal = this.openDismissModal.bind( this );
3333
this.closeDismissModal = this.closeDismissModal.bind( this );
3434
this.bodyNotificationRef = createRef();
35+
this.toggleButtonRef = createRef();
3536
this.screen = getScreenName();
3637
}
3738

@@ -116,9 +117,13 @@ class InboxNoteCard extends Component {
116117
'components-popover__content',
117118
];
118119
// This line is for IE compatibility.
119-
const relatedTarget = event.relatedTarget
120-
? event.relatedTarget
121-
: document.activeElement;
120+
let relatedTarget;
121+
if ( event.relatedTarget ) {
122+
relatedTarget = event.relatedTarget;
123+
} else if ( this.toggleButtonRef.current ) {
124+
const ownerDoc = this.toggleButtonRef.current.ownerDocument;
125+
relatedTarget = ownerDoc ? ownerDoc.activeElement : null;
126+
}
122127
const isClickOutsideDropdown = relatedTarget
123128
? dropdownClasses.some( ( className ) =>
124129
relatedTarget.className.includes( className )
@@ -146,6 +151,7 @@ class InboxNoteCard extends Component {
146151
<Button
147152
isTertiary
148153
onClick={ onToggle }
154+
ref={ this.toggleButtonRef }
149155
onBlur={ ( event ) =>
150156
this.handleBlur( event, onClose )
151157
}

0 commit comments

Comments
 (0)