Commit e1f59f5b authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Explicitly set cursor position as workaround for event order problem

If a line edit gets focus and there is no selection, then the line edit
selects all text. If an empty line edit gets focus for the first time,
then selecting all text triggers a cursor changed signal and an
accessible text cursor event. By this time, the line edit is already
set as focus widget, but the accessible focus event has not yet been
sent.
orca sets the line edit as locus of focus when it receives a text cursor
event for an item with the focused flag. This makes orca ignore the
focus event following the text cursor event, so that the newly focused
line edit is not announced to the user. This might be considered bug in
orca, but maybe other screen readers behave similarly.
Explicitly setting the cursor position to 0 prevents the emission of the
accessible text cursor event when the line edit gets the input focus
(because Qt doesn't emit this event twice for the same cursor position),
so that orca properly announces the line edit.

GnuPG-bug-id: 6095
parent 5df7ff9e
Pipeline #208846 passed with stage
in 2 minutes and 13 seconds
......@@ -153,6 +153,7 @@ public:
ui.groupsFilter->setAccessibleName(i18nc("@label", "Search groups"));
ui.groupsFilter->setToolTip(i18nc("@info:tooltip", "Search the list for groups matching the search term."));
ui.groupsFilter->setPlaceholderText(i18nc("@info::placeholder", "Enter search term"));
ui.groupsFilter->setCursorPosition(0); // prevent emission of accessible text cursor event before accessible focus event
label->setBuddy(ui.groupsFilter);
hbox->addWidget(ui.groupsFilter, 1);
......
......@@ -106,6 +106,7 @@ public:
ui.availableKeysFilter->setAccessibleName(i18nc("@label", "Search available keys"));
ui.availableKeysFilter->setToolTip(i18nc("@info:tooltip", "Search the list of available keys for keys matching the search term."));
ui.availableKeysFilter->setPlaceholderText(i18nc("@info::placeholder", "Enter search term"));
ui.availableKeysFilter->setCursorPosition(0); // prevent emission of accessible text cursor event before accessible focus event
label->setBuddy(ui.availableKeysFilter);
hbox->addWidget(ui.availableKeysFilter, 1);
......@@ -163,6 +164,7 @@ public:
ui.groupKeysFilter->setAccessibleName(i18nc("@label", "Search group keys"));
ui.groupKeysFilter->setToolTip(i18nc("@info:tooltip", "Search the list of group keys for keys matching the search term."));
ui.groupKeysFilter->setPlaceholderText(i18nc("@info::placeholder", "Enter search term"));
ui.groupKeysFilter->setCursorPosition(0); // prevent emission of accessible text cursor event before accessible focus event
label->setBuddy(ui.groupKeysFilter);
hbox->addWidget(ui.groupKeysFilter, 1);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment