Skip to content

The click event should not be triggered by the right mouse button. #35666

Closed

Description

@kongbai1996

Describe the bug:
The right mouse button should not trigger the click event, only the contextmenu event should be triggered.

To Reproduce:
testcase:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            border: 2px black solid;
            width: 360px;
            height: 50px;
        }
    </style>
</head>

<body>
<div id="out" style="height: 100%">
    <div id="div" style="background-color: green;">div1 touch time</div>
</div>
<div id="result"></div>
</body>
<script>
    let result = document.getElementById("result");
    for (const touch of ["touchstart", "touchend", "touchmove", "touchcancel", "click", "contextmenu", "mousedown", "mouseup"]) {
        div.addEventListener(touch, function (e) {
            result.innerHTML += `<p>${div.id} ${touch} fire. time:${e.timeStamp}, now:${Date.now()}, now:${performance.now()}</p>`
        })
    }
</script>
</html>

Image

Image

Platform:
linux

Activity

  1. added
    C-untriaged
    on Feb 26, 2025
  2. added
    C-has-manual-testcase
    on Feb 26, 2025
  3. added
    I-wrong
    and removed
    C-untriaged
    on Feb 26, 2025
  4. yezhizhen commented on Apr 10, 2025

    @yezhizhen
    Member

    @servo-highfive assign me

  5. servo-highfive commented on Apr 10, 2025

    @servo-highfive

    Hey @yezhizhen! Thanks for your interest in working on this issue. It's now assigned to you!

  6. added
    C-assigned
    on Apr 10, 2025
  7. added a commit that references this issue on Apr 21, 2025
    990ed88
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-inputC-assignedC-has-manual-testcaseI-wrong

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions