Leaving context menu on panel = editor nonresponsive


#1

The problem:
I have added a context menu to my plugin just to be able to close the panel it uses.

So If I ctrl+click on the panel and then NOT click on the context menu but instead decide to to click back on the editor window the editor will not function correctly.

Only the following keys will function: backspace, tab, enter, arrows and that is it. None of the other key will function.

The only way I have found to get the keys to function again is to click on the panel again.

Do you know what am I doing wrong ?

The plugin I am talking about is this

A screenshot of the context menu which is rather simple. :


#2

Another screenshot to help to explain the problem


#3

When I click somewhere other than Close panel, that context menu goes away.


#4

Yes it does. Which is fine and that is what you expect.

After the context menu opens you should click on the text editor window. The context menu will close. But You will not be able to edit the text.

I didn’t seem to be able to explain it well enough i guess :))


#5

Actually it is only happening on my Mac on PC it seems to work fine …


#6

Interesting. I tried to replicate the problem using other panels including both find-and-replace panels and tree-view. Here’s what I did:

  1. Right-click some element in the panel to bring up the context menu (find-and-replace I used one of the text input elements, tree-view I used a file or folder)
  2. Single-click anywhere in an open text editor

The context menu would go away, but the focus would remain on the element that was right-clicked … not in the editor.

If you can replicate my experience above with the built-in packages, I would look at the difference in how you implement the context menu in your package versus the built-in ones.


#7

OK. Thank you for that I am already closer to what might be happening.

So after the context menu closes it will pass the focus onto one of the elements in the panel. I never actually manage the focus on the panel. So I supposed to pass that focus back to the editor somehow ?

What is strange that while backspace arrows etc … move the cursor other letters don’t work. : )

Now that I looked at it on my pc I am actually wondering if it’s limited to my machine or not …

My implementation of the context menu is straight from here

Actually the up to date link is :

{
    "context-menu": {
        "atom-text-editor": [{
            "label": "Toggle Fold Navigator",
            "command": "fold-navigator:toggle"
        }],
        ".fold-navigator": [{
            "label": "Close panel",
            "command": "fold-navigator:close"
        }]
    },
    "menu": [{
        "label": "Packages",
        "submenu": [{
            "label": "Fold Navigator",
            "submenu": [{
                "label": "Toggle",
                "command": "fold-navigator:toggle"
            }]
        }]
    }, {
        "label": "View",
        "submenu": [{
            "label": "Toggle Fold Navigator",
            "command": "fold-navigator:toggle"
        }]
    }]
}

#8

I don’t know that the format has changed much since then but you’re referring to a really old version of the docs there. Check out:


#9

I noticed after posting but the docs are identical in this case