Skip to content

Attaching of onclick handler causes unexpected highlighting in Mobile Safari #238

Closed
@sophiebits

Description

@sophiebits

@yungsters's recent commit 4deb0d6 makes onClick work in Mobile Safari by attaching an empty onclick handler on touchstart. However, this causes subtly different behavior from DOM events without React. Consider the JSX:

<div onClick={...}>
    <img src="a.png" />
    <img src="b.png" />
</div>

When an image is tapped, the onclick handler is attached to the image and so when the browser draws the light gray touch highlight, only the image is highlighted.

Compare with the HTML

<div onclick=...>
    <img src="a.png">
    <img src="b.png">
</div>

where the entire div is highlighted when clicking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions