Skip to content

Make default sketch canvas ID autoincrement#7836

Merged
ksen0 merged 3 commits intoprocessing:dev-2.0from
limzykenneth:sketch-id
May 3, 2026
Merged

Make default sketch canvas ID autoincrement#7836
ksen0 merged 3 commits intoprocessing:dev-2.0from
limzykenneth:sketch-id

Conversation

@limzykenneth
Copy link
Copy Markdown
Member

Resolves #7834

Changes:
There are two parts to this PR, the first is to not assign an ID to the canvas element if it already has an ID thereby preserving the user intended one.

The second part makes the default ID (assigned when the canvas don't already have an ID) to have an autoincrementing number. This is done so that if there are multiple sketches created by the user, they will not all be assigned the same ID which is technically not good practice (ID should be unique). However, I'm not sure if this is the right approach because I'm also thinking whether we should assign default ID's to sketch canvas at all.

We already add a class to the canvas so they can be collectively selected if needed while the ID along with the autoincrementing aspect makes the numbering potentially unstable and so may not be entirely reliable as a selector. The ID is not used internally and externally it probably shouldn't be relied on to be a specific value since the ID is something that the user can change. So another potential solution is to remove the sketch ID assignment entirely.

@p5-bot
Copy link
Copy Markdown

p5-bot Bot commented May 1, 2026

Continuous Release

CDN link

Published Packages

Commit hash: 37fd403

Previous deployments

c5453e4


This is an automated message.

@ksen0 ksen0 merged commit bbbcedd into processing:dev-2.0 May 3, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants