summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2022-10-31 12:44:48 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-11-03 17:47:47 +0000
commit5faba47f95d0dd336f041b409de3130f637d7ffd (patch)
tree1116352941ed716303427bf63bdf439e7f324013 /src/widgets/kernel/qwidget.cpp
parent9c3434c4e73c8ee8d20243d28d5806366159ce75 (diff)
Revert "Accessibility: don't emit focus change when reason is window activation"
This reverts commit 79a11470f3c4c61951906223f97001a77ce36500, which resulted in QTBUG-105735. The new behavior is worse and affects multiple screen readers, while the old issue is isolated to Windows Narrator and could be considered a narrator bug. Task-number: QTBUG-105735 Change-Id: Ic8be1dbd592a3fdf2c3219ec4c5524bc2c7f0f6a Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit d300a0fe765259d490c3510c9e2a8bac58e0aa15) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 361e12887a..a5ba895105 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -6516,15 +6516,11 @@ void QWidget::setFocus(Qt::FocusReason reason)
QApplicationPrivate::setFocusWidget(f, reason);
#if QT_CONFIG(accessibility)
- // If the widget gets focus because its window becomes active, then the accessibility
- // subsystem is already informed about the window opening, and also knows which child
- // within the window has focus. Don't interrupt it by emitting another focus event.
- if (reason != Qt::ActiveWindowFocusReason) {
- // menus update the focus manually and this would create bogus events
- if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem"))) {
- QAccessibleEvent event(f, QAccessible::Focus);
- QAccessible::updateAccessibility(&event);
- }
+ // menus update the focus manually and this would create bogus events
+ if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
+ {
+ QAccessibleEvent event(f, QAccessible::Focus);
+ QAccessible::updateAccessibility(&event);
}
#endif
#if QT_CONFIG(graphicsview)