Android: Exclude the QtWindow itself from Accessibilty

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 <assam.boudjelthia@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
(cherry picked from commit 46cb9027f1ed6c61faec5364b5537ae7ab9e57c1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
bb10
Julian Greilich 2024-07-31 14:01:41 +02:00 committed by Qt Cherry-pick Bot
parent 571a4a3efb
commit b2706531e9
1 changed files with 2 additions and 0 deletions

View File

@ -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;
}