Skip to content

Fixes #17701 - Integrated Terminal Context Menu is triggered via contextmenu event instead of mousedown#18980

Merged
Tyriar merged 1 commit intomicrosoft:masterfrom
chirag64:master
Feb 11, 2017
Merged

Fixes #17701 - Integrated Terminal Context Menu is triggered via contextmenu event instead of mousedown#18980
Tyriar merged 1 commit intomicrosoft:masterfrom
chirag64:master

Conversation

@chirag64
Copy link
Contributor

Before this change, the Context Menu used to show up on mousedown event in the integrated terminal, but on mouseup (contextmenu event) inside the editor. This change is clearly visible on Windows rather than OS X or Linux when you hold the right-click button.

Now the behavior of the context menu of integrated terminal should be consistent with that of the editor

@msftclas
Copy link

Hi @chirag64, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, MSBOT;

@Tyriar
Copy link
Member

Tyriar commented Jan 22, 2017

Thanks @chirag64, I'll look at this in a week or so since we're in the process of finishing up/verifying the next release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the right click copy/paste stuff still be in the mousedown handler and cancel the event if it goes off? I think cmd copies/pastes on mousedown rather than mouseup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that cmd in Windows copy-pastes on 'mousedown' rather than 'mouseup'. Do you want me to keep the code inside the if condition within 'mousedown' and just move the else condition code in 'contextmenu' event?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's ideal 👍 and make sure the event is canceled such that a rightClickCopyPaste mousedown event does not trigger the contextmenu event.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking I can use the if condition of getRightClickCopyPaste in the mousedown event and revert the if condition of getRightClickCopyPaste in the contextmenu event. Not sure how I can cancel the triggering of the event any other way, maybe I'm missing something obvious here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try returning false inside the mousedown handler when the rightClickCopyPaste is done, I would expect that to prevent the contextmenu event.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do event.preventDefault or event.stopPropagation() work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried both, but didn't work. I was sure one of these would work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last try: stopImmediatePropagation() 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried all 4 together, no luck. ☹

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well we don't want to regress with right click copy paste so we'll probably want to keep a boolean member variable that we'll use to "cancel" the contextmenu event.

… via contextmenu event instead of mousedown
@chirag64
Copy link
Contributor Author

@Tyriar Can you please review my recent commit 184e728? I've added a boolean variable that we can use to 'cancel' the contextmenu event.

@Tyriar
Copy link
Member

Tyriar commented Feb 11, 2017

Perfect! Thanks for the contribution 😃

@Tyriar Tyriar merged commit f65c156 into microsoft:master Feb 11, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants