### Godot version

v4.1.stable.official [970459615]

### System information

Godot v4.1.stable - Windows 10.0.22000 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 30.0.15.1295) - Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 Threads)

### Issue description

`OptionButton` menu's do not seem to be closable using a joypad. They can be closed using `ESC` on a keyboard. Setting a `ui_cancel` mapping for the joypad does not fix the issue. Further, the `MenuButton` seems to exhibit the same behaviour based on this [Reddit post](https://www.reddit.com/r/godot/comments/142d8pa/how_to_exit_a_menubutton_with_gamepad/). I would expect to be able to close the menu from the joypad using a button mapped to `ui_cancel`. 

### Steps to reproduce

1. Add an OptionButton to project
2. Setup `ui_cancel` input mapping to have a joypad mapping
3. Run the project and open the OptionButton menu.
4. Try to close the window without selecting an option using the joypad. This is the step that does not work. Pressing `ESC` will close the window. 

### Minimal reproduction project

[OptionButtonReproProject.zip](https://github.com/godotengine/godot/files/12294459/OptionButtonReproProject.zip)
String c = p_cancel;
	if (p_cancel.is_empty()) {
		c = "Cancel";
	}
	Button *b = swap_cancel_ok ? add_button(c, true) : add_button(c);
	b->connect("pressed", callable_mp(this, &AcceptDialog::_cancel_pressed));
	return b;
}
void AcceptDialog::remove_button(Control *p_button) {