-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.11
-
None
-
Debian testing, qtbase self-compiled from git dev as of d61356bf323a67c7b723ddba3fe2ad719c5b91b3
The QAccessibleTextInterface::getTextAtOffset implementation doesn't only return actual words, but e.g. also returns the space character that splits single words as a word as well.
As discussed previously in https://codereview.qt-project.org/c/qt/qtbase/+/673670 , this is inconsistent with the behavior for QTextEdit or also other non-Qt implementations, like text editors on Android (tested with TalkBack word navigation in https://f-droid.org/en/packages/org.billthefarmer.editor/ ).
Looking into the QAccessibleTextInterface::textAtOffset method implementation that gets used, it also seems inconsistent with what the underlying QTextBoundaryFinder logic actually considers a text unit, as the space is not a unit that goes from a QTextBoundaryFinder::StartOfItem to a QTextBoundaryFinder::EndOfItem, but from a QTextBoundaryFinder::EndOfItem to a QTextBoundaryFinder::StartOfItem, i.e. in my interpretation lies between two actual word units.
Sample steps to reproduce, using the corresponding methods of the AT-SPI2 Text interface on Linux:
- Build and run this sample program
#include <QApplication> #include <QLineEdit> #include <QMainWindow> #include <QTextEdit> #include <QVBoxLayout> int main(int argc, char* argv[]) { QApplication a(argc, argv); QMainWindow w; QWidget* widget = new QWidget; w.setCentralWidget(widget); QVBoxLayout* layout = new QVBoxLayout(widget); layout->addWidget(new QLineEdit("Hello world")); layout->addWidget(new QTextEdit("Hello world")); w.show(); return a.exec(); }
- start Accerciser Accessibility Explorer ( https://gitlab.gnome.org/GNOME/accerciser )
- in Accerciser's treeview of the sample program's a11y hierarchy, select the object for the QTextEdit
- in Accerciser's IPython console, use the AT-SPI2 Text interface to get words at certain offsets:
In [125]: acc.queryText().getTextAtOffset(0, 1) In [129]: acc.queryText().getTextAtOffset(0, 1) Out[129]: ('Hello', 0, 5) In [130]: acc.queryText().getTextAtOffset(5, 1) Out[130]: ('Hello', 0, 5) In [131]: acc.queryText().getTextAtOffset(6, 1) Out[131]: ('world', 6, 11)
- in Accerciser's treeview of the sample program's a11y hierarchy, now select the object for the QLineEdit
- in Accerciser's IPython console, use the AT-SPI2 Text interface to get words at certain offsets:
In [125]: acc.queryText().getTextAtOffset(0, 1) Out[125]: ('Hello', 0, 5) In [126]: acc.queryText().getTextAtOffset(5, 1) Out[126]: (' ', 5, 6) In [127]: acc.queryText().getTextAtOffset(6, 1) Out[127]: ('world', 6, 11)
Actual result:
For the QLineEdit, the space character is returned as a word, but it isn't for the QTextEdit.
Expected result:
The QLineEdit's accessibility implementation shouldn't consider the space character as a separate word, but be consistent with other implementations (s. more details above).
| For Gerrit Dashboard: QTBUG-141389 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 685544,1 | a11y: Only consider actual text units as such | dev | qt/qtbase | Status: NEW | 0 | 0 |