typora-issues icon indicating copy to clipboard operation
typora-issues copied to clipboard

Context menu item must be activated on mouse up on Files sidebar

Open pvginkel opened this issue 3 years ago • 3 comments

Describe the bug Context menu item must be activated on mouse up, not on mouse down.

To Reproduce Steps to reproduce the behavior:

  1. Click View | Toggle Sidebar.
  2. Select the Files tab.
  3. Ensure a folder is opened.
  4. Right click on any file or folder.
  5. Press the mouse while over an item.
  6. The item is activated on mouse down.

Expected behavior The menu item is only activated on mouse up.

Desktop (please complete the following information):

  • OS: Windows 10

Typora Version 1.3.8

pvginkel avatar Jul 19 '22 06:07 pvginkel

In my test context menu item is activated on mouse up, could you provide more details?

abnerlee avatar Jul 22 '22 14:07 abnerlee

I was specifically looking in the file viewer context menu. The one you get when you right click on a file or directory. I just checked and the context menu in the text editor works just fine. I'll update the report.

pvginkel avatar Jul 23 '22 19:07 pvginkel

I have updated to 1.4.4 and I'm still seeing the same behavior, at least in the Files sidebar. If I right client on a folder, then press down on e.g. "New File" it immediately adds the file and closes the menu.

pvginkel avatar Sep 07 '22 07:09 pvginkel

Well, I took a stab at it myself. I fixed the issue by editing the following file in notepad: C:\Program Files\Typora\resources\appsrc\window\frame.js.

Search for this:

}b("#file-menu").on("mousedown"

And replace it with:

}b("#file-menu").on("mousedown","[data-key]",function(n){n.preventDefault();});b("#file-menu").on("mouseup"

This changes the mousedown handler into a mouseup handler. Something else was interfering with the menu after I just changed the name of the event handler. The preventDefault() call on mousedown does seem to fix this. I'll report back here if I find any issues with this fix.

If you make this change yourself, and we do get a future update of this product, you'll have to make the change again. This file will be overwritten on update.

pvginkel avatar Jan 18 '23 20:01 pvginkel