Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4979

The onRightClick event was triggered on a disabled Button since Chrome 92

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • 9.5.1.3
    • Browser Issue, Components
    • Chrome Version 92.0.4515.107 (Official Build) (x86_64)
      Edge Version 93.0.957.0 (Official build) Dev (x86_64)

      Steps to Reproduce

      <zk>
        <button disabled="true" onRightClick='alert("triggered")' label="Right-click me!"/>
      </zk>
      

      Right-click on the button.

      Current Result

      Only Chromium-based browsers trigger a right-click event.

      Expected Result

      No onRightClick event should be triggered.

      Debug Information

      Since Chrome 92.

      A reproducible HTML example:

      <div id="outer">
          <button id="btn" disabled>Right-click me!</button>
      </div>
      <script>
      document.getElementById('outer').addEventListener('contextmenu', (e) => console.log('outer received'));
      document.getElementById('btn').addEventListener('contextmenu', (e) => console.log('btn received'));
      </script>
      

      Since parents will receive the event, ZK will handle the event and send it back to the server.

      Not sure it's a bug or a feature.

      Workaround


            DevChu DevChu
            rudyhuang rudyhuang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h