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

Windows/Accessibility: QPushButton with a QMenu attached is not identified correctly to a screen reader

    XMLWordPrintable

Details

    • Windows

    Description

      Repro steps:

      1. Create a QPushButton and attach a QMenu as shown below.
      2. Open a screen reader such as NVDA.
        1. https://github.com/nvaccess/nvda
        2. https://www.nvaccess.org/download
      3. Use Tab key to focus the menu button.
      4. Observe.

      Expected results:

      • The screen reader describes the button as "collapsed" if it has a menu.

      Actual results:

      • The screen reader describes the button the same way it would describe a button without a menu.

      Additional info:

      • My application uses Qt 5.15.1 but I've found the same behavior in QtCreator 16.0 using Qt 6.8.2.

      Code sample:

      #include <QApplication>
      #include <QDialog>
      #include <QMenu>
      #include <QPushButton>
      #include <QVBoxLayout>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QCoreApplication::setApplicationName("Qt NVDA menu button bug");
      
          QDialog dialog;
          dialog.setLayout(new QVBoxLayout());
      
          auto menuButton = new QPushButton("With Menu");
          menuButton->setMenu(new QMenu());
          menuButton->menu()->setAccessibleName("Actions");
          menuButton->menu()->addAction("Action 1");
          menuButton->menu()->addAction("Action 2");
      
          auto noMenuButton = new QPushButton("Without Menu");
      
          dialog.layout()->addWidget(menuButton);
          dialog.layout()->addWidget(noMenuButton);
      
          return dialog.exec();
      }
      

      Attachments

        1. 135005.patch
          9 kB
          Mitchell Loftus
        2. 135005.png
          46 kB
          Mitchell Loftus
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            mloftus Mitchell Loftus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes