Skip to content
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

PopupMenu accelerators don't work. #40836

Closed
SekoiaTree opened this issue Jul 29, 2020 · 6 comments · Fixed by #81621
Closed

PopupMenu accelerators don't work. #40836

SekoiaTree opened this issue Jul 29, 2020 · 6 comments · Fixed by #81621

Comments

@SekoiaTree
Copy link
Contributor

Godot version:
3.2.stable.official

OS/device including version:
OS: Windows 10

Issue description:
A PopupMenu's accelerator does not work when using any kind of add_item. The item will be clickable, will have the hint on the right of the shortcut, but the accelerator will simply not work. From the docs:

Accelerators are special combinations of keys that activate the item, no matter which control is focused.

Steps to reproduce:
Create a popupmenu in any scene. Give the PopupMenu the following code:

	
func _ready():
	add_item("PopupMenu bug test", 0, KEY_A)
	call_deferred("popup_centered_ratio") #This call_deferred is only so the popupmenu would open on scene launch. This bug happens for any call of any popup, at any time.




func _on_PopupMenu_id_pressed(id):
	print("Object Pressed")

Connect the id_pressed signal to itself, and launch the scene.

On scene launch, the popupmenu will contain a button with the label "PopupMenu bug test" and a grayed out "A" on the right. Pressing "A" should activate the button, printing "Object Pressed". This does not happen. Upon clicking the item, it does.

Minimal reproduction project:
PopupMenuBugReport.zip

This project contains the above code, plus a couple practicality nodes.

@EricEzaM
Copy link
Contributor

Cannot reproduce in 4.0 master 10150f7b5

@SekoiaTree
Copy link
Contributor Author

Did you try the demo project? It's still not working for me.

@dominiks
Copy link
Contributor

dominiks commented Oct 20, 2020

Can confirm for 3.2.3 that the accelerator only works for menus that belong to a MenuButton. It seems there is no way to call the menu's activate_item_by_event from somewhere else but the MenuButton.

I think it should be possible to send input events to the menu via activate_item_by_event from GDScript and make accelerators usable for context menus. Or have the menu receive input events when it is visible and decouple the accelerator activation from the owner of the menu.

@goblinJoel
Copy link

Can confirm for 3.5.1 using the test project. Pressing A never seems to do anything, but clicking the button with the "A" at the end of it does.

@Calinou
Copy link
Member

Calinou commented Aug 7, 2023

I can reproduce this on 4.2.dev 16a9356 (Linux).

@EricEzaM How did you get it to work on your end?

@EricEzaM
Copy link
Contributor

EricEzaM commented Aug 8, 2023

I'm not sure, that was 3 years ago now. It's possible I didn't reproduce the setup correctly, or it was inadvertently fixed for a of time back then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants