offapi/com/sun/star/accessibility/AccessibleRole.idl | 6 +++--- vcl/source/accessibility/vclxaccessibleedit.cxx | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-)
New commits: commit 5777aa1af83a395dc86542012e465c30619d5a15 Author: Michael Weghorn <[email protected]> AuthorDate: Tue Oct 7 11:50:15 2025 +0200 Commit: Michael Weghorn <[email protected]> CommitDate: Tue Oct 7 13:44:02 2025 +0200 tdf#104833 tdf#135435 vcl a11y: Use TEXT role for readonly edit ... instead of STATIC. This was originally changed from AccessibleRole::TEXT to AccessibleRole::LABEL and then AccessibleRole::STATIC in commit fa775ed30ad8969dacca34ddb63b76a89d8ba7da Date: Tue Feb 20 13:55:53 2018 +0100 tdf#86661 a11y: give ROLE_LABEL to read-only edit ROLE_TEXT is for editable text, ROLE_LABEL should be used for static text, so that screen readers know they should speak it. and commit ac475d8d6fb68798ebd77f291bef6336e580859a Date: Wed Aug 8 13:39:31 2018 +0200 tdf#116542 a11y: Make R/O accessibleedit use STATIC role as improvement to tdf#86661 which had made it a LABEL as first improvement over TEXT. . However, that distinction between TEXT and STATIC for editable vs. readonly objects doesn't match what platform a11y APIs actually use, which focus more on the object being interactive or not, and an edit is a control that can receive keyboard focus, so is interactive. Quoting from the ATSPI_ROLE_TEXT doc [1]: > An interactive widget that supports multiple lines of text and > optionally accepts user input, but whose purpose is not to solicit user > input. Thus ATSPI_ROLE_TEXT is appropriate for the text view in a plain > text editor but inappropriate for an input field in a dialog box or web > form. For widgets whose purpose is to solicit input from the user, see > ATSPI_ROLE_ENTRY and ATSPI_ROLE_PASSWORD_TEXT. Quoting from the AT_SPI_ROLE_STATIC doc [2]: > A generic non-container object whose purpose is to display a brief > amount of information to the user and whose role is known by the > implementor but lacks semantic value for the user. Examples in which > ATSPI_ROLE_STATIC is appropriate include the message displayed in a > message box and an image used as an alternative means to display text. > ATSPI_ROLE_STATIC should not be applied to widgets which are > traditionally interactive, objects which display a significant amount of > content, or any object which has an accessible relation pointing to > another object. The displayed information, as a general rule, should be > exposed through the accessible name of the object. For labels which > describe another widget, see ATSPI_ROLE_LABEL. For text views, see > ATSPI_ROLE_TEXT. VclMultiLineEdit (for which VCLXAccessibleEdit is the a11y implementation) is used in SalInstanceTextView, i.e. used for implementing a text view, for which the above suggests to use ATSPI_ROLE_TEXT. GTK 3 also reports a read-only GtkTextView with AT_SPI_ROLE_TEXT (and not having the ATSPI_STATE_EDITABLE state), so this commit also aligns it with that. The MSAA/IAccessible doc [3] also matches for this. > ROLE_SYSTEM_TEXT > > The object represents selectable text that allows > edits or is designated as read-only. and > ROLE_SYSTEM_STATICTEXT > > The object represents read-only text, such as labels > for other controls or instructions in a dialog box. > Static text cannot be modified or selected. In LO, text in readonly edits can be selected, so that also makes ROLE_SYSTEM_TEXT more appropriate. Therefore, use AccessibleRole::TEXT again. This makes the NVDA screen reader on Windows announce the status text in the "Help" -> "Check for Updates" dialog (requires --enable-online-update autogen option). Also update the AccessibleRole idl description accordingly to align better with the AT-SPI and MSAA/IAccessible semantics as described above. If the STATIC role is preferred in a particular case, it can still explicitly set for the corresponding widget in the .ui file. [1] https://docs.gtk.org/atspi2/enum.Role.html#text [2] https://docs.gtk.org/atspi2/enum.Role.html#static [3] https://learn.microsoft.com/en-us/windows/win32/winauto/object-roles Change-Id: I58f35864eedb1b527c1af651f88612ef96678138 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192017 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/offapi/com/sun/star/accessibility/AccessibleRole.idl b/offapi/com/sun/star/accessibility/AccessibleRole.idl index 09fac50df7de..9d38189b682a 100644 --- a/offapi/com/sun/star/accessibility/AccessibleRole.idl +++ b/offapi/com/sun/star/accessibility/AccessibleRole.idl @@ -492,8 +492,8 @@ constants AccessibleRole /** Text role. - <p>An object that presents text to the user. The text is usually - editable by the user as opposed to a label or static text.</p> + <p>An interactive object that presents text to the user and optionally + accepts user input.</p> <p>See also LABEL and STATIC.</p> */ @@ -725,7 +725,7 @@ constants AccessibleRole /** Static text role. <p>An object that presents a brief amount of information to the user. - The text is not editable by the user as opposed to a text, and not + The object is not interactive as opposed to a text, and not meant to have a relation with another object as opposed to a label.</p> diff --git a/vcl/source/accessibility/vclxaccessibleedit.cxx b/vcl/source/accessibility/vclxaccessibleedit.cxx index fd2938a38aaf..68d93710bbe8 100644 --- a/vcl/source/accessibility/vclxaccessibleedit.cxx +++ b/vcl/source/accessibility/vclxaccessibleedit.cxx @@ -219,8 +219,6 @@ sal_Int16 VCLXAccessibleEdit::implGetAccessibleRole( ) VclPtr< Edit > pEdit = GetAs< Edit >(); if ( pEdit && ( pEdit->IsPassword() || pEdit->GetEchoChar() ) ) nRole = AccessibleRole::PASSWORD_TEXT; - else if ( pEdit && ( pEdit->GetStyle() & WB_READONLY ) ) - nRole = AccessibleRole::STATIC; else nRole = AccessibleRole::TEXT;
