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

wasm: Paste in standardContextMenu is not enabled by default while clipboard access is allowed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.2, 6.9.0
    • GUI: Menus
    • None
    • WebAssembly

    Description

      Description:

      When running a Qt application compiled to WebAssembly (WASM) and accessed via a web browser, clipboard access is normally restricted unless triggered by a user gesture (e.g., clicking a button or performing a keyboard shortcut). However, modern browsers (such as Chrome, Firefox) allow overriding this restriction by granting clipboard permissions at the domain level.

      Issue:

      Even when clipboard access has been explicitly allowed for the domain (e.g., via browser settings), the Qt application's context menu does not enable the "Paste" option by default. This is contrary to expected behavior—when the domain has clipboard access, user gestures should no longer be required, and "Paste" should be fully functional through the context menu.

      Expected Behavior:

      • If clipboard permissions are granted for the domain:
        • The application should recognize clipboard access as available.
        • The "Paste" option in the context menu should be enabled by default.
        • No user gesture should be required to access clipboard contents.

      Current Behavior:

      • Clipboard access remains dependent on a user gesture, even when domain-level permissions are granted.
      • As a result, the "Paste" context menu entry remains disabled unless a manual user gesture is performed prior.

      Steps to Reproduce:

      1. Run a Qt WASM application here: https://hyperborg.com/cp/v6.8.2/copypaste.html
      1. Right mouse button to get context menu (Paste is disabled)

      3. In the browser, grant clipboard permissions for the domain (e.g., chrome://settings/content/clipboard).

      4. Reload the application.

      5. Right-click on the input field and observe the context menu.

      6. Note that "Paste" remains disabled despite clipboard access being allowed.

      Additional Notes:

      • This affects UX significantly in web-deployed Qt apps.
      • Clipboard access should be re-evaluated in context menu logic based on current browser permissions, not just user gesture history.

      Attachments

        1. image-2025-04-25-10-13-56-628.png
          31 kB
          Imre Nagy
        2. image-2025-04-25-10-15-30-539.png
          74 kB
          Imre Nagy
        3. image-2025-04-25-10-16-30-321.png
          28 kB
          Imre Nagy
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.webassembly qt.webassembly
            hyperborg Imre Nagy
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes