Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-3184

Accessibility issues with QTextEdit when using screen readers (e.g., NVDA)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P2: Important P2: Important
    • None
    • 6.9.0
    • PySide
    • None
    • Windows

      I would like to report several accessibility issues related to *QTextEdit* when using a screen reader such as *NVDA*.

      Read-only mode

      When setting a `QTextEdit` to read-only using:

      ```
      self.setReadOnly(True)
      ```

      the screen reader cannot navigate through the text using the keyboard because the cursor does not move.

      Workaround:

      ```
      self.setTextInteractionFlags(
      Qt.TextInteractionFlag.TextSelectableByKeyboard |
      Qt.TextInteractionFlag.TextSelectableByMouse
      )
      ```

      Line wrapping

      When line wrapping is enabled (`setLineWrapMode(QTextEdit.LineWrapMode.WidgetWidth)`), NVDA ignores part of the text if it spans multiple lines. This happens because the cursor movement does not correspond correctly to the wrapped lines.

      Workaround:

      ```
      self.setLineWrapMode(QTextEdit.LineWrapMode.NoWrap)
      ```

      However, this forces very long lines (e.g., 100 words in one line), which is not practical.

      Arabic diacritics

      When navigating character by character through Arabic text with diacritics, the cursor skips the diacritic marks.
      Example:

      ```
      مَرْحَبًا
      ```

      Moving the cursor from "م" to the next character skips the diacritic "َ" and goes directly to "ر".

      Workaround:

      ```
      document = self.document()
      document.setDefaultCursorMoveStyle(Qt.CursorMoveStyle.VisualMoveStyle)
      ```

      Cursor at end of line

      With the above workaround enabled, if the cursor is at the end of a line and I press the right arrow key to move to the next line, it fails. The cursor stays on the same line instead of moving down.

      Empty lines navigation

      When navigating across empty lines, The screen reader repeats reading the first non-empty line instead of reporting the empty lines correctly.

      Expected behavior

      • Screen readers should be able to navigate text in `QTextEdit` consistently in both read-only and editable modes.
      • Line wrapping should not interfere with cursor movement.
      • Arabic diacritics (harakat) should be accessible when navigating character by character.
      • The cursor should move correctly across lines, including at line breaks and empty lines.

      Actual behavior

      • Navigation is inconsistent in read-only mode.
      • Wrapped text is not read properly.
      • Arabic diacritics are skipped.
      • Cursor does not move to the next line at line breaks.
      • Empty lines are announced incorrectly.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            crmaurei Cristian Maureira-Fredes
            qais Qais Alrefai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes