Skip to content

Text-based canvas accessibility throws error on out-of-Y-bounds shapes #7130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 17 tasks
bojidar-bg opened this issue Jul 15, 2024 · 9 comments · Fixed by #7135
Closed
1 of 17 tasks

Text-based canvas accessibility throws error on out-of-Y-bounds shapes #7130

bojidar-bg opened this issue Jul 15, 2024 · 9 comments · Fixed by #7135

Comments

@bojidar-bg
Copy link

bojidar-bg commented Jul 15, 2024

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

1.9.4

Web browser and version

Firefox 127.0.2

Operating system

Arch Linux

Steps to reproduce this

Steps:

  1. Create a new sketch in the web editor. (or use this one: https://editor.p5js.org/bojidar-bg/sketches/mHXQgF7Sw)
  2. Add a shape that is out-of-bounds on the Y axis, e.g. rect(200, 450, 10, 10)
  3. Enable Table-text canvas accessibility in the editor's settings (Big cog wheel top right / Accessibility / Accessible text-based canvas / Table-text)
  4. Run the sketch.
  5. Observe TypeError: cells[ingredients[x][y].loc.locY] is undefined; coming from:
    if (!cells[ingredients[x][y].loc.locY][ingredients[x][y].loc.locX]) {

Snippet:

function setup() {
  createCanvas(400, 400);
}
function draw() {
  background(220);
  rect(200, 450, 10, 10)
}
@KamiNoAnt
Copy link

Having Plain-Text checked or both causes the same issue

@bojidar-bg bojidar-bg changed the title Table-text canvas accessibility ends up throwing error on out-of-Y-bounds shapes Text-based canvas accessibility throws error on out-of-Y-bounds shapes Jul 15, 2024
@bojidar-bg
Copy link
Author

Actually, I can't reproduce the issue with plan-text accessibility checked, after refreshing the page. Might be something to it however, so, mm, changed the title.

@KamiNoAnt
Copy link

KamiNoAnt commented Jul 15, 2024

I think it is weaker with Plain-Text. Maybe you need more shapes, that are out of bounds or shapes that are really far away from the canvas

edit:
https://editor.p5js.org/HolyAnt/sketches/g25tcz0bB
having Plain-Text on in this isn't giving an error but it messes with the mouseY value. I'm guessing Plain-Text messes with the value, when there are several shapes, that are out of bounds and with different y-coordinates and having too many shapes will probably result in an error.

@bojidar-bg
Copy link
Author

Hm.. might be worth splitting the plain-text bug into a separate issue, since it's probably caused by a different part of p5.js's code.

@limzykenneth
Copy link
Member

Thanks @bojidar-bg. Just to confirm, is this an editor specific issue or a bug with p5.js itself?

@bojidar-bg
Copy link
Author

@limzykenneth Well.. no idea how to turn text-based canvas accessibility on from the sketch itself, but I'm pretty sure the culprit is in p5.js's code and not in the editor's code.

@limzykenneth
Copy link
Member

Ok I'm able to replicate this locally as well. The problem is likely due to the rect being drawn offscreen and the accessibility feature (which is the gridOutput() function) tries to index a grid that is out of index bounds. I'll try to look into this this week for a fix.

@limzykenneth
Copy link
Member

@KamiNoAnt What you describe sounds like a different issue, can you open another issue for it? Thanks.

@HectorDev309
Copy link

I had this same issue, I managed to solve it by adding gridOutput = function(){} inside the setup() function, of course you are literally making a built-in function unusable, but I never had to use it, so it works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants