Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve Accessibility Guidance fordescribe() Usage#8101

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
perminder-17 merged 68 commits intoprocessing:dev-2.0fromNalinDalal:dev-2.0
Nov 9, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
68 commits
Select commitHold shift + click to select a range
06019f3
Add fontWidth() and clarify textWidth vs fontWidth docs in attributes.js
NalinDalalSep 14, 2025
8f24e3e
Merge branch 'processing:dev-2.0' into dev-2.0
NalinDalalSep 18, 2025
0aaf553
updated as per maintainers comment, only documentation is updated
NalinDalalSep 18, 2025
486e2db
Add fontWidth() and clarify textWidth vs fontWidth docs in attributes…
NalinDalalSep 18, 2025
944779c
Merge branch 'processing:dev-2.0' into dev-2.0
NalinDalalSep 19, 2025
6633de2
aded docs for difference between textWidth and fontWidth with respect…
NalinDalalSep 19, 2025
eb58aba
unnecesaary file introduced, removed it, cleanedup the thing i was su…
NalinDalalSep 19, 2025
78ce6ac
Merge branch 'processing:dev-2.0' into dev-2.0
NalinDalalSep 22, 2025
2759e37
docs updated as asked
NalinDalalSep 22, 2025
3da06c0
removed things from previous pr
NalinDalalSep 23, 2025
f911702
i think done, if not will ask maintainer
NalinDalalSep 23, 2025
a0fae01
Merge branch 'dev-2.0' into dev-2.0
NalinDalalSep 24, 2025
b218819
check, merge conflicts
NalinDalalSep 24, 2025
cebc00c
Merge branch 'dev-2.0' into dev-2.0
NalinDalalSep 25, 2025
e2bd6b1
Merge branch 'dev-2.0' into dev-2.0
NalinDalalSep 29, 2025
8549b93
updated the docs as per suggesstion from perminder
NalinDalalOct 3, 2025
cf75292
Merge branch 'dev-2.0' of https://github.com/NalinDalal/p5.js into de…
NalinDalalOct 3, 2025
51534d6
Merge branch 'processing:dev-2.0' into dev-2.0
NalinDalalOct 9, 2025
74601d0
fixes as per review
NalinDalalOct 13, 2025
7cc2d8b
Merge branch 'dev-2.0' into dev-2.0
NalinDalalOct 14, 2025
1ef5b37
Merge branch 'dev-2.0' into dev-2.0
NalinDalalOct 15, 2025
84ee41e
updated the bad code and good code examples, so actually now can diff…
NalinDalalOct 15, 2025
493ceed
Merge branch 'processing:dev-2.0' into dev-2.0
NalinDalalOct 16, 2025
30d45e8
fix:inverted comma typos
NalinDalalOct 16, 2025
95a02d7
invert typos
NalinDalalOct 16, 2025
e8ae5d1
invert typos
NalinDalalOct 16, 2025
218313c
invert typos
NalinDalalOct 16, 2025
e10f7d0
invert typos
NalinDalalOct 16, 2025
6a2e30b
invert typos
NalinDalalOct 16, 2025
3dea4a1
invert typos
NalinDalalOct 16, 2025
0f90b46
invert typos
NalinDalalOct 16, 2025
2b0ead8
invert typos
NalinDalalOct 16, 2025
dd4afcb
invert typos
NalinDalalOct 16, 2025
86a3f24
invert typos
NalinDalalOct 16, 2025
d1b961c
invert typos
NalinDalalOct 16, 2025
0c0e5c8
invert typos
NalinDalalOct 16, 2025
cb89f1e
invert typos
NalinDalalOct 16, 2025
907cb87
invert typos
NalinDalalOct 16, 2025
d3e7e7a
invert typos
NalinDalalOct 16, 2025
8e60de2
invert typos
NalinDalalOct 16, 2025
3b9f224
invert typos
NalinDalalOct 16, 2025
f0b012f
invert typos
NalinDalalOct 16, 2025
bcd8324
invert typos to do fix
NalinDalalOct 16, 2025
b01a556
invert typos to do fix
NalinDalalOct 16, 2025
ed84b40
invert typos to do fix
NalinDalalOct 16, 2025
2ba8f22
invert typos to do fix
NalinDalalOct 16, 2025
b082995
invert typos to do fix
NalinDalalOct 16, 2025
fd71a5d
invert typos to do fix
NalinDalalOct 16, 2025
a9fac53
invert typos to do fix
NalinDalalOct 16, 2025
26dd043
invert typos to do fix
NalinDalalOct 16, 2025
c15d11a
invert typos to do fix
NalinDalalOct 16, 2025
89f8bad
invert typos to do fix
NalinDalalOct 16, 2025
a8cd5db
invert typos to do fix
NalinDalalOct 16, 2025
73841a3
invert typos to do fix
NalinDalalOct 16, 2025
aef34ea
invert typos to do fix
NalinDalalOct 16, 2025
68e6ff2
Merge branch 'dev-2.0' into dev-2.0
ksen0Oct 21, 2025
986975a
Merge branch 'dev-2.0' into dev-2.0
NalinDalalNov 4, 2025
af359ff
had docs style section repeated, removed to resolve redundancy
NalinDalalNov 4, 2025
7273777
Merge branch 'dev-2.0' into dev-2.0
NalinDalalNov 5, 2025
c725f1c
Merge branch 'dev-2.0' into dev-2.0
NalinDalalNov 5, 2025
a920765
Merge branch 'dev-2.0' into dev-2.0
ksen0Nov 9, 2025
c184cdc
Tidy web accessibility updates
ksen0Nov 9, 2025
78e68ca
Tidy updates to documentation style guide
ksen0Nov 9, 2025
b204ab7
Tidy documentation style guide table of contents
ksen0Nov 9, 2025
e96ba87
Tidy web accessibility references in contributor docs
ksen0Nov 9, 2025
6713dec
Tidy contributing documentation for describe()
ksen0Nov 9, 2025
d71cf73
Tidy unintended change in textCore.js
ksen0Nov 9, 2025
db39e61
Update contributor_docs/documentation_style_guide.md
perminder-17Nov 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some comments aren't visible on the classic Files Changed page.

2 changes: 1 addition & 1 deletioncontributor_docs/contributing_to_the_p5js_reference.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -308,7 +308,7 @@ Finally, for every example you add, you are required to use the p5.js function `
* </div>
```

For more on `describe()` visit the [web accessibility contributor documentation](./web_accessibility/#describe).
For more on `describe()` visit the [web accessibility contributor documentation](./web_accessibility/#describe), and the [Writing Accessible Canvas Descriptions](https://p5js.org/tutorials/writing-accessible-canvas-descriptions/) tutorial.

With all the above you should have most of the tools needed to write and edit p5.js reference comments. However, there are a few more specialized usage of JSDoc style reference comments that you may come across in p5.js. These are situationally useful and not something that you need often.

Expand Down
49 changes: 47 additions & 2 deletionscontributor_docs/documentation_style_guide.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,7 @@ Our community is large and diverse. Many people learn to code using p5.js, and a
### Code
- [Code Samples](#code-samples)
- [Comments](#comments)
- [Accessible Canvas Labels](#accessible-canvas-labels)
- [Whitespace](#whitespace)
- [Semicolons](#semicolons)
- [Naming Conventions](#naming-conventions)
Expand DownExpand Up@@ -116,7 +117,7 @@ Always use `let` to declare variables.

**Pronouns**

| Recommended |Not Recommended |
| Recommended |Not Recommended |
| -- | -- |
| they | he or she |
| them | him or her |
Expand All@@ -142,7 +143,7 @@ Always use `let` to declare variables.

The following terminology is adapted from the WordPress documentation guidelines for [Writing inclusive documentation](https://make.wordpress.org/docs/style-guide/general-guidelines/inclusivity/#accessibility-terminology). For more background on people-first language, see the CDC's guide on [Communicating With and About People with Disabilities](https://www.cdc.gov/ncbddd/disabilityandhealth/materials/factsheets/fs-communicating-with-people.html).

| Recommended |Not Recommended |
| Recommended |Not Recommended |
| -- | -- |
| person with disability | the disabled, handicapped, differently abled, challenged, abnormal |
| person without disability | normal person, healthy person, able-bodied |
Expand DownExpand Up@@ -230,6 +231,50 @@ let magicWord = 'Please';

```


**[⬆ back to top](#table-of-contents)**

## Accessible Canvas Labels

- Use `describe()` to in p5.js example code, to add labels to your canvas so that it’s readable for screen readers.

> Why? It makes examples accessible to screen readers, and models how to write good canvas labels.


```javascript
// Good.
function setup() {
createCanvas(100, 100);
describe('A red heart in the bottom right corner of a pink background.');
}

// Bad.
function setup() {
createCanvas(100, 100);
describe('heart shape');
}

// Good.
function draw() {
background(220);
fill(0, 255, 0);
ellipse(mouseX, 50, 40, 40);
// Label updates with shape's translation.
describe(`A green circle at x pos ${round(mouseX)} moving with the mouse pointer.`, LABEL);
}
```

- Don’t use screen reader labels as a way of commenting your code. Labels should only summarize the resulting visual elements within a canvas.

- Don’t overuse screen reader labels, as you may end up complicating the screen reader’s interpretation of the canvas rather than helping it.

- Do make your label descriptions short and accurate. The recommended length for label descriptions is one to two sentences. Use full sentences for your labels, and write in the present tense when describing elements.

The above examples and suggestions are based on the [Writing Accessible Canvas Descriptions tutorial](https://p5js.org/tutorials/writing-accessible-canvas-descriptions/). This tutorial gives more detailed guidance, and includes other ways to label your canvas, in addition to `describe()`: `describeElement()`, `textOutput()`, and `gridOutput()`.

To understand the structure of p5.js’ web accessibility features for contributors, see the [Web Accessibility Contributor Doc](./web_accessibility.md#user-generated-accessible-canvas-descriptions).


**[⬆ back to top](#table-of-contents)**

## Whitespace
Expand Down
13 changes: 6 additions & 7 deletionscontributor_docs/web_accessibility.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -51,10 +51,10 @@ This description is followed by a list of shapes where the color, position, and
> orange circle at top left covering 1% of the canvas.\
> fuchsia square, at bottom right, covering 2% of the canvas.

Each element can be selected to get more details. A table of elements is also provided. In this table, each element’sshape, color, location, coordinates, and area are described:
Each element can be selected to get more details. A table of elements is also provided. In this table, each element’s shape, color, location, coordinates, and area are described:

> orange circle location=top left area=1%\
> fuchsia squarelocation = bottom right area = 2%
> fuchsia square location = bottom right area = 2%

<details>
<summary>This generates the following HTML:</summary>
Expand DownExpand Up@@ -100,7 +100,7 @@ Each element can be selected to get more details. A table of elements is also pr

`gridOutput()` lays out the content of the canvas in the form of a grid using an HTML table element. Each shape’s location in the grid is based on its spatial location on the canvas. A brief description of the canvas is available before the table output. This description includes the color of the background, size of the canvas, number of objects, and object types:

> lavender blue canvas, 400 by 400 pixels, contains 2 shapes:1 circle 1 square
> lavender blue canvas, 400 by 400 pixels, contains 2 shapes: 1 circle 1 square

Each shape’s description is placed in a cell of the table depending on its location on the canvas. Each description includes the color and type of shape:

Expand All@@ -123,8 +123,8 @@ The generated HTML is as follows:
<div id="defaultCanvas0gridOutput">
Grid Output
<p id="defaultCanvas0gridOutput_summary" aria-label="grid output summary">
white canvas, 400 by 400 pixels, contains 2 shapes: 1 circle 1 square
</p>
white canvas, 400 by 400 pixels, contains 2 shapes: 1 circle 1 square
</p>
<table id="defaultCanvas0gridOutput_map" summary="grid output content">
<tbody>
<tr></tr>
Expand DownExpand Up@@ -272,7 +272,7 @@ The page will output:

### describeElement()

The `describeElement()` function creates a screen reader-accessible description for groups of shapes that create meaning together. For example, a custom-drawn “heart” shape made out of multiple lines of code. The first parameter should be a string with the name of the element, for example, “Heart”. The second parameter should be a string with the description of the element, for example, “A red heart in the bottom-right corner.” The third parameter is optional. If a user passes `LABEL` as a third parameter, an additional `<div>` element is inserted next to the `<canvas>` element. The new \<div> will contain a visible version of the samedescription embedded in the `<canvas>` element.
The `describeElement()` function creates a screen reader-accessible description for groups of shapes that create meaning together. For example, a custom-drawn “heart” shape made out of multiple lines of code. The first parameter should be a string with the name of the element, for example, “Heart”. The second parameter should be a string with the description of the element, for example, “A red heart in the bottom-right corner.” The third parameter is optional. If a user passes `LABEL` as a third parameter, an additional `<div>` element is inserted next to the `<canvas>` element. The new \<div> will contain a visible version of the same description embedded in the `<canvas>` element.

`describeElement()` is supported by several functions in [src/accessibility/describe.js](https://github.com/processing/p5.js/blob/main/src/accessibility/describe.js):

Expand DownExpand Up@@ -300,4 +300,3 @@ function setup() {
The page will output:

![A p5.js canvas, followed by two lines of description: "A red heart and yellow circle over a pink background," and "Heart: A red heart in the bottom-right corner."](images/sketch-text-output3.png)

Loading

[8]ページ先頭

©2009-2025 Movatter.jp