Skip to content

Commit

Permalink
Fix unknonw div props in context menu (#9277)
Browse files Browse the repository at this point in the history
  • Loading branch information
weeman1337 committed Sep 14, 2022
1 parent eace4d6 commit 41960b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/components/structures/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,13 @@ export default class ContextMenu extends React.PureComponent<IProps, IState> {
</FocusLock>;
}

// filter props that are invalid for DOM elements
const {
hasBackground: _hasBackground, // eslint-disable-line @typescript-eslint/no-unused-vars
onFinished: _onFinished, // eslint-disable-line @typescript-eslint/no-unused-vars
...divProps
} = props;

return (
<RovingTabIndexProvider handleHomeEnd handleUpDown onKeyDown={this.onKeyDown}>
{ ({ onKeyDownHandler }) => (
Expand All @@ -413,7 +420,7 @@ export default class ContextMenu extends React.PureComponent<IProps, IState> {
style={menuStyle}
ref={this.collectContextMenuRect}
role={managed ? "menu" : undefined}
{...props}
{...divProps}
>
{ body }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ exports[`<SpaceContextMenu /> renders menu correctly 1`] = `
/>
<div
className="mx_ContextualMenu"
hasBackground={true}
onFinished={[MockFunction]}
role="menu"
style={Object {}}
>
Expand Down

0 comments on commit 41960b1

Please sign in to comment.