Skip to content

Commit

Permalink
Merge pull request #4179 from parasharrajat/right-click
Browse files Browse the repository at this point in the history
Fix: Enable default context-menu on messages being edited
  • Loading branch information
deetergp authored Jul 26, 2021
2 parents 57dac86 + be9b748 commit 59c393d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/PressableWithSecondaryInteraction/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class PressableWithSecondaryInteraction extends Component {
*/
executeSecondaryInteractionOnContextMenu(e) {
const selection = window.getSelection().toString();
e.preventDefault();
if (this.props.preventDefaultContentMenu) {
e.preventDefault();
}
this.props.onSecondaryInteraction(e, selection);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ const propTypes = {

/** The ref to the search input (may be null on small screen widths) */
forwardedRef: PropTypes.func,

/** Prevent the default ContextMenu on web/Desktop */
preventDefaultContentMenu: PropTypes.bool,
};

const defaultProps = {
forwardedRef: () => {},
onPressIn: () => {},
onPressOut: () => {},
preventDefaultContentMenu: true,
};

export {propTypes, defaultProps};
1 change: 1 addition & 0 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ class ReportActionItem extends Component {
onPressIn={() => this.props.isSmallScreenWidth && canUseTouchScreen() && ControlSelection.block()}
onPressOut={() => ControlSelection.unblock()}
onSecondaryInteraction={this.showPopover}
preventDefaultContentMenu={!this.props.draftMessage}
>
<Hoverable resetsOnClickOutside={false}>
{hovered => (
Expand Down

0 comments on commit 59c393d

Please sign in to comment.