Browse Source

Do not apply Menu accelerator key if a LineEdit element is focused. Closes #2100.

Lasse Öörni 8 years ago
parent
commit
c2bc19df2b
1 changed files with 5 additions and 2 deletions
  1. 5 2
      Source/Urho3D/UI/Menu.cpp

+ 5 - 2
Source/Urho3D/UI/Menu.cpp

@@ -25,6 +25,7 @@
 #include "../Core/Context.h"
 #include "../Input/InputEvents.h"
 #include "../IO/Log.h"
+#include "../UI/LineEdit.h"
 #include "../UI/Menu.h"
 #include "../UI/UI.h"
 #include "../UI/UIEvents.h"
@@ -430,8 +431,10 @@ void Menu::HandleKeyDown(StringHash eventType, VariantMap& eventData)
         (acceleratorQualifiers_ == QUAL_ANY || eventData[P_QUALIFIERS].GetInt() == acceleratorQualifiers_) &&
         eventData[P_REPEAT].GetBool() == false)
     {
-        // Ignore if UI has modal element
-        if (GetSubsystem<UI>()->HasModalElement())
+        // Ignore if UI has modal element or focused LineEdit
+        UI* ui = GetSubsystem<UI>();
+        UIElement* focusElement = ui->GetFocusElement();
+        if (ui->HasModalElement() || (focusElement && focusElement->GetType() == LineEdit::GetTypeStatic()))
             return;
 
         HandlePressedReleased(eventType, eventData);