Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-100866

Grid accessible fails to delete accessible items with reuseItems set

    XMLWordPrintable

Details

    • macOS
    • 0d2f739b6 (dev)

    Description

      When you modify the model of a gridView with an accessible delegate, by clearing and adding items to the model, the old model items still appear in the accessibility navigation. This has been reproduced with the below code on macOS 10.15.7 in Qt5.15.7 and Qt6.2.3.

      Repro steps using the below code:
      1. Start accessibility (CMD + F5)
      2. Press `switchGrid` Button
      3. Tab and the previously visible grid items will be read out followed by the currently visible items

      Note: The insert is not needed to see the removed items still existing in the accessibility chain, just the clear

      import QtQuick 2.15
      import QtQml 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Layouts 1.15
      
      ApplicationWindow {
          width: 640
          height: 480
          visible: true
      
          ColumnLayout {
              anchors.fill: parent
              Button {
                  Layout.preferredHeight: 50
                  Layout.fillWidth: true
      
                  text: "switchGrid"
                  onClicked: {
                      model1.clear()
                      model1.insert(0, {"name" : "Moritz"})
                      model1.insert(1, {"name" : "Georg"})
                      model1.insert(2, {"name" : "Tina"})
                      model1.insert(3, {"name" : "Bruno"})
                  }
              }
      
              GridView {
                  id: grid
      
                  Layout.fillWidth: true
                  Layout.fillHeight: true
      
                  model: model1
      
                  cellWidth: 180
                  cellHeight: 30
      
                  delegate: Text {
                       id: textDelegate
                       text: name
                       color: "black"
                       activeFocusOnTab: true
                       font.bold: activeFocus
                       TapHandler {
                           onTapped: parent.forceActiveFocus()
                       }
                       Accessible.role: Accessible.Button
                       Accessible.name: name
                       Accessible.selected: false
                       Accessible.selectable: true
                       Accessible.focusable: true
                  }
                  reuseItems: true
                  clip:true
              }
          }
      
          ListModel {
              id: model1
              ListElement { name: "Joe"}
              ListElement { name: "Ben"}
              ListElement { name: "Steve"}
              ListElement { name: "Edwin"}
          }
      }
      

       

       

       

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            joecresswell Joseph Cresswell
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes