From b2706531e996a9a24fdc51cced859d03e7a88cc5 Mon Sep 17 00:00:00 2001 From: Julian Greilich Date: Wed, 31 Jul 2024 14:01:41 +0200 Subject: [PATCH] Android: Exclude the QtWindow itself from Accessibilty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the QtWindow and its QtEditText are focusable only to hand over events to other components, the QtWindow itself should not be focusable by TalkBack, since this leads to an unnecessary nameless A11y-Element in the A11y tree. Task-number: QTBUG-126672 Change-Id: I532b9d3e252fbe01da7c953446242b045c57eebe Reviewed-by: Assam Boudjelthia Reviewed-by: Jan Arve Sæther (cherry picked from commit 46cb9027f1ed6c61faec5364b5537ae7ab9e57c1) Reviewed-by: Qt Cherry-pick Bot --- src/android/jar/src/org/qtproject/qt/android/QtWindow.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/android/jar/src/org/qtproject/qt/android/QtWindow.java b/src/android/jar/src/org/qtproject/qt/android/QtWindow.java index bfe1009af4..47d8086ecc 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtWindow.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtWindow.java @@ -33,6 +33,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface { setParent(parentWindow); setFocusableInTouchMode(true); setDefaultFocusHighlightEnabled(false); + setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); // Views are by default visible, but QWindows are not. // We should ideally pick up the actual QWindow state here, @@ -45,6 +46,7 @@ class QtWindow extends QtLayout implements QtSurfaceInterface { m_editText = new QtEditText(context, listener); addView(m_editText, new QtLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + m_editText.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } else { m_editText = null; }