Skip to content

Commit

Permalink
Fix on restore focus ctx menu (#18434)
Browse files Browse the repository at this point in the history
Co-authored-by: Pankaj Gaur <[email protected]>
  • Loading branch information
pagaur and Pankaj Gaur authored Jun 3, 2021
1 parent e42563e commit 30fd711
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fixing onRestoreFocus merge issue between v7/V8",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ class ContextualMenuInternal extends React.Component<IContextualMenuInternalProp
}

private _tryFocusPreviousActiveElement = (options: IPopupRestoreFocusParams) => {
if (options && options.documentContainsFocus && this._previousActiveElement) {
if (this.props.onRestoreFocus) {
this.props.onRestoreFocus(options);
} else if (options && options.documentContainsFocus && this._previousActiveElement) {
// Make sure that the focus method actually exists
// In some cases the object might exist but not be a real element.
// This is primarily for IE 11 and should be removed once IE 11 is no longer in use.
Expand Down

0 comments on commit 30fd711

Please sign in to comment.