-
Notifications
You must be signed in to change notification settings - Fork 375
[Feature] Prevent context click from changing document.activeElement #320
Comments
Can you open a PR with the intended changes? |
Not sure I'll ever find the time, but knowing that you're open to the PR I will at least try to. Thanks for your response! |
Expected - For example, right click on this text, and select copy -- the initially selected text remains selected in the browser. Actual - When i right click on text where 'react-contextmenu' is activated, and selecting an option from the context menu, my initial selection is lost.
Is this related to this bug, should I raise another? Thank you |
@manoharreddyporeddy I believe Preventing the focus from changing should be pretty easy, but will prevent users from using |
Thanks for reply @slapbox A - scenario B. May be bug? C. How to build? |
For building you can just see https://github.com/vkbansal/react-contextmenu/blob/master/package.json#L28 |
@manoharreddyporeddy, For testing's sake, what happens if you add If no, what if you use: event.preventDefault();
return; Obviously this will break the context menu completely, but it should not steal focus from your text area. If it still steals the focus, something weird is going on. Let me know how it goes! |
Thanks for trying to help.
Then already added above lines in various places in the same function. After trying this for 2 days, I am trying to not use the library - but unfortunately I have written a lot of code for this already - with demo time coming soon I am in a bit of problem trusting this library to take care of things. I would like to ask one question:
Thank you |
@manoharreddyporeddy I spent probably a bit over an hour reviewing the available context menus for React. I'd strongly recommend focusing on solving the issue on this library rather than writing an entire new library. The solution should be pretty much as simple as Did you try the two troubleshooting tips I suggested above? If you let me know the outcome of those two things that would be a big help in figuring out the problem. Unfortunately I don't have any advice whatsoever for building a context menu from scratch. |
@manoharreddyporeddy can you visually demonstrate what you're trying to achieve? I'm starting to question whether I understand properly. Regarding how to make a context menu on your own, start with PopperJS or React-Popper (based on PopperJS). |
@manoharreddyporeddy I, like you, have a full-time job, family and responsibilities. I'm sorry that I was not able to help you. If you are not happy with this project, please go ahead and use some other project. You must understand that 90% of such open-source projects are maintained by single person team, who take out some time from their free/family time to help others. Here are some links for other packages that you can use: |
I have previously give the scenario already:
That means, In other words, i need the text selected + 2 options from context menu I selected for the selected text (from 2 right clicks) this is same as The "text selection remains" is not happening with this library. Since you din't ask a question, my assumption was you understood, it cost another day. |
It is obvious that open source is like that - single or some more person jobs |
@manoharreddyporeddy obviously English is not your first language. Your responses seem kind of rude. I'm sure you're stressed out, but when people try to help you, and when you are not a native speaker, you should not fault the reader for not understanding. I did ask a question, as soon as you wrote something that gave me reason to think I didn't understand. I'm going to assume though that you don't mean to be rude, and that this is just a language barrier thing, so I have poked around a bit further. The issue I have is that I lose focus when I click to open the context menu. It sounds like you're not losing focus until you actually click one of the menu items. If that's the case, the relevant code appears to be here: https://github.com/vkbansal/react-contextmenu/blob/master/src/MenuItem.js#L78-L87 Add an |
@manoharreddyporeddy I think I did not say anything wrong here. I just pointed you to alternatives if this library is not a good solution for a problem. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale. @vkbansal is there a way to prevent stalebot from |
I'll into removing stalebot. |
closing issue see #339 |
It would be great to avoid taking focus when the user right clicks the
<ContextMenuTrigger />
I know this is probably impossible to achieve with the longpress action, but it would great if it were the case for right clicks.
The text was updated successfully, but these errors were encountered: