Base accessibility API.
This commit is contained in:
@ -126,6 +126,14 @@ int MenuButton::get_item_count() const {
|
||||
|
||||
void MenuButton::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
|
||||
RID ae = get_accessibility_element();
|
||||
ERR_FAIL_COND(ae.is_null());
|
||||
|
||||
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_BUTTON);
|
||||
DisplayServer::get_singleton()->accessibility_update_set_popup_type(ae, DisplayServer::AccessibilityPopupType::POPUP_MENU);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
|
||||
popup->set_layout_direction((Window::LayoutDirection)get_layout_direction());
|
||||
} break;
|
||||
@ -218,7 +226,7 @@ MenuButton::MenuButton(const String &p_text) :
|
||||
set_toggle_mode(true);
|
||||
set_disable_shortcuts(false);
|
||||
set_process_shortcut_input(true);
|
||||
set_focus_mode(FOCUS_NONE);
|
||||
set_focus_mode(FOCUS_ACCESSIBILITY);
|
||||
set_action_mode(ACTION_MODE_BUTTON_PRESS);
|
||||
|
||||
popup = memnew(PopupMenu);
|
||||
|
||||
Reference in New Issue
Block a user