### Godot version

v4.2.dev3.official [013e8e3af]

### System information

Windows 10, 64bit

### Issue description

![image](https://github.com/godotengine/godot/assets/35988767/ccdac68c-a60d-491b-a406-d6e3bc1c95ae)
![GIF](https://github.com/godotengine/godot/assets/35988767/7d230faf-0260-4bc3-92e8-11cd026931a8)


### Steps to reproduce

/

### Minimal reproduction project

/
popup_pos.y += theme_cache.menu_icon->get_height();
				popup->set_position(popup_pos);
				popup->popup();
				return;
			}
		} else {
			if (popup && pos.x > size.width - theme_cache.menu_icon->get_width()) {
				emit_signal(SNAME("pre_popup_pressed"));
				Vector2 popup_pos = get_screen_position();
				popup_pos.x += size.width - popup->get_size().width;
				popup_pos.y += theme_cache.menu_icon->get_height();
				popup->set_position(popup_pos);
				popup->popup();
				return;
			}
		}
	}
	Ref<InputEventMouseMotion> mm = p_event;
	if (mm.is_valid()) {
		Point2 pos = mm->get_position();
		Size2 size = get_size();
		
		if (pos.y > _get_top_margin()) {
			if (menu_hovered) {
				menu_hovered = false;
				queue_redraw();
			}
			return;
		}
		if (popup) {