From 66fa5aeec5dbeba978f70fe464fbc87c3aba8ed2 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 6 Nov 2023 11:06:16 +0100 Subject: qt a11y: Set passwordEdit state for PASSWORD_TEXT The Qt API doesn't have a separate role to distinguish password edits from other text edits, but has a `passwordEdit` state. Set that state for objects that have role `AccessibleRole::PASSWORD_TEXT`. With this in place, password entries, e.g. the one in the "Tools" -> "Options" -> "Security" -> "Password for Web Connections" -> "Master Password" dialog, are exposed via the `ATSPI_ROLE_PASSWORD_TEXT` role with the qt6 VCL plugin on Linux, because Qt's AT-SPI adapter takes the `passwordEdit` state into account when mapping the Qt a11y roles to AT-SPI ones. [1] [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=c5d9e4a7a78b82ed31e5225c169de4718dfe4f05#n1637 Change-Id: Icb3f0935e703e2786c5704007cad7eea9070f8a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158987 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- vcl/qt5/QtAccessibleWidget.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'vcl') diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index cba67bc60cc8..cbd750a4da38 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -465,6 +465,8 @@ QAccessible::Role QtAccessibleWidget::role() const case AccessibleRole::BLOCK_QUOTE: return QAccessible::Paragraph; case AccessibleRole::PASSWORD_TEXT: + // Qt API doesn't have a separate role to distinguish password edits, + // but a 'passwordEdit' state return QAccessible::EditableText; case AccessibleRole::POPUP_MENU: return QAccessible::PopupMenu; @@ -687,6 +689,9 @@ QAccessible::State QtAccessibleWidget::state() const lcl_addState(&state, nState); } + if (xAc->getAccessibleRole() == AccessibleRole::PASSWORD_TEXT) + state.passwordEdit = true; + return state; } -- cgit