From 9d65be69416d9a3964d5e80cf8393f63e6615534 Mon Sep 17 00:00:00 2001 From: zhouyan Date: Thu, 4 Jan 2024 09:28:02 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=B0=E5=BB=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E7=82=B9=E5=87=BB=E4=BF=9D=E5=AD=98=E9=94=AE?= =?UTF-8?q?=E7=9B=98=E8=87=AA=E5=8A=A8=E5=BC=B9=E5=87=BA=E5=8F=88=E6=94=B6?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouyan Change-Id: Id3f805fae743cb8ca7f5728f8dfb628210d50583 --- .../pattern/text_field/text_field_pattern.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp index 2788b26caef..d3501d64289 100644 --- a/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp +++ b/frameworks/core/components_ng/pattern/text_field/text_field_pattern.cpp @@ -967,6 +967,13 @@ bool TextFieldPattern::OnKeyEvent(const KeyEvent& event) isFocusedBeforeClick_ = false; HandleOnSelectAll(true); } + auto pipeline = PipelineContext::GetCurrentContext(); + CHECK_NULL_RETURN(pipeline, false); + auto textFieldManager = DynamicCast(pipeline->GetTextFieldManager()); + if (event.code == KeyCode::KEY_TAB && HasFocus() && !needToRequestKeyboardOnFocus_ && needToRequestKeyboardInner_ && + textFieldManager->GetImeShow()) { + RequestKeyboard(false, true, true); + } return TextInputClient::HandleKeyEvent(event); } @@ -3997,14 +4004,6 @@ void TextFieldPattern::OnAreaChangedInner() void TextFieldPattern::RequestKeyboardOnFocus() { - auto pipeline = PipelineContext::GetCurrentContext(); - CHECK_NULL_VOID(pipeline); - auto textFieldManager = DynamicCast(pipeline->GetTextFieldManager()); - if (HasFocus() && !needToRequestKeyboardOnFocus_ && needToRequestKeyboardInner_ && textFieldManager->GetImeShow()) { - if (!RequestKeyboard(false, true, true)) { - return; - } - } if (!needToRequestKeyboardOnFocus_ || !needToRequestKeyboardInner_) { return; } -- Gitee