Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.9.0 FF
-
None
-
Debian testing, qtbase self-compiled from commit 755733f5917b1389277b61336f8ca5a03873e446
Description
Qt doesn't require having a QDialog/QMainWindow/... as a top-level in the widget hierarchy, but allows having any QWidget as the top-level.
Using a simple QWidget as the top-level however currently comes with the problem that the window isn't reflected in the accessibility hierarchy, as only widgets are reflected in the accessibility hierarchy, while QWindow is not.
As a consequence, Qt apps using a simple QWidget as the top-level don't report any object with top-level role on the AT-SPI level, which is incorrect.
Steps to reproduce:
- Build and run a simple sample program like the following:
#include <QApplication> #include <QLabel> int main(int argc, char* argv[]) { QApplication a(argc, argv); QLabel label("My label"); label.show(); return a.exec(); }
- start Accerciser and take a look at the accessible hierarchy of the sample application
Actual result
The app only has a single top-level child with role "label"
Expected result:
The app should have a top-level object with the AT-SPI "frame" role to represent the window. That top-level object should have the object with role label as a child.
Further information:
- The Orca screen reader currently needs a workaround because of this: https://gitlab.gnome.org/GNOME/orca/-/commit/d0a0b84c7cbb0aa560a58527e652823a90a77992 (Quoting from the commit message: "Unfortunately, some Qt apps don't expose valid roles
for the top-level object. The top-level object should never have a
role of filler, for instance.") - This was discussed in https://codereview.qt-project.org/c/qt/qtbase/+/592200/comments/20d2250f_efecdd07 earlier, with the suggestion to create an issue to keep track.
- The behavior is as expected when using a "proper" top-level widget as the top-level in the Qt application, e.g. a QMainWindow or a QDialog, for example:
#include <QApplication> #include <QLabel> #include <QMainWindow> int main(int argc, char* argv[]) { QApplication a(argc, argv); QMainWindow window; QLabel* label = new QLabel("My label"); window.setCentralWidget(label); window.show(); return a.exec(); }
However, if Qt doesn't require app developers to have a "proper" top-level in the widget hierarchy, it should in my opinion still take care of exposing one on the accessibility level (e.g. for the associated QWindow).