Skip to content

fix: use node ID instead of running index for menu #12500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

kittaakos
Copy link
Contributor

What it does

This PR switches from a running index (number) menu handler to the menu node's technical ID (string).

How to test

Start the example electron app, and once you see the Sample Menu popping up, click File > New File multiple times. When the app loads, the highest number of Untitled-$NUMBER equals the times you click on the New File menu during the app startup. So if you click the menu thrice, expect to see Untitled-3.

Closes #12493

12493.mp4

Review checklist

Reminder for reviewers

@vince-fugnitto vince-fugnitto added the electron issues related to the electron target label May 15, 2023
@kittaakos
Copy link
Contributor Author

Can you please help with this, @tsmaeder? Thank you!

@tsmaeder tsmaeder self-requested a review May 31, 2023 09:25
@JonasHelming
Copy link
Contributor

@tsmaeder Ping?

@tsmaeder
Copy link
Contributor

@kittaakos finally had time to come back to this one. The implementation here does not really reflect the discussion in #12493. How shall we proceed?

@kittaakos
Copy link
Contributor Author

kittaakos commented Aug 21, 2023

Another bug this PR should cover is the very first non-functional context menu item. Handler IDs start from 0:

The internal node ID is incremented here:

handlerId = nextHandlerId++;

But it won't work here because it will be 0:

The following DTO does not get a click handler:

{
  "id": "file.newFile",
  "accelerator": "Cmd+Shift+N",
  "label": "New Tab",
  "handlerId": 0,
  "checked": false,
  "enabled": true,
  "type": "normal",
  "visible": true
}

@kittaakos kittaakos marked this pull request as draft August 21, 2023 10:42
kittaakos pushed a commit to arduino/arduino-ide that referenced this pull request Aug 21, 2023
The very first context menu item with ID `0` has not had a click handler

Ref: eclipse-theia/theia#12500
Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit to arduino/arduino-ide that referenced this pull request Aug 22, 2023
The very first context menu item with ID `0` has not had a click handler

Ref: eclipse-theia/theia#12500
Signed-off-by: Akos Kitta <[email protected]>
@tsmaeder
Copy link
Contributor

@kittaakos finally had time to come back to this one. The implementation here does not really reflect the discussion in #12493. How shall we proceed?

Ping?

@kittaakos
Copy link
Contributor Author

Thanks for the ping. I have not had time to return to this PR; it's in draft.

Downstream, we use the proposed fix since 1.37.0.

@kittaakos
Copy link
Contributor Author

Closing due to lack of interest.

@kittaakos kittaakos closed this Dec 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
electron issues related to the electron target
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[electron] Executing the commands from menu items has no effect when the application starts. It worked with 1.36.0
4 participants