processing / processing/p5.js

mousePressed / touchStarted not working on iOS Safari

Open
#8,401 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area:Events Bug
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)
p5.js version

2.1.1

Web browser and version

iOS 26

Operating system

iOS

Steps to reproduce this

2 Steps:

  1. Open THIS SKETCH on Safari on iOS
  2. Press any button

I have a keyPressed() function in the button class.

function screenInteract() {  
button.keyPressed(); 
} 

function mousePressed() {   
screenInteract(mouseX, mouseY); 
} 

function touchStarted() {
if (touches.length > 0) {
    screenInteract(touches[0].x, touches[0].y);
  }
  return false;
}

function touchEnded() {
if (touches.length > 0) {
    screenInteract(touches[0].x, touches[0].y);
  }
  return false;
}

This does work on Chrome on Android. Any help appreciated!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by opening the linked sketch with p5.js 2.1.1 in Safari on iOS and reproduce the button interaction. Trace the mousePressed(), touchStarted(), and touchEnded() handlers shown in the report, then verify that the same interaction works on iOS Safari as it does in Chrome on Android.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.