Skip to content

Commit d7ecaa6

Browse files
authored
Merge branch 'develop' into pr05/migrate_routes_folder
2 parents 793e95c + 06b1586 commit d7ecaa6

File tree

12 files changed

+138
-54
lines changed

12 files changed

+138
-54
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ I have verified that this pull request:
88
* [ ] has no test errors (`npm run test`)
99
* [ ] is from a uniquely-named feature branch and is up to date with the `develop` branch.
1010
* [ ] is descriptively named and links to an issue number, i.e. `Fixes #123`
11+
* [ ] meets the standards outlined in the [accessibility guidelines](https://github.com/processing/p5.js-web-editor/blob/develop/contributor_docs/accessibility.md)

client/index.jsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,25 @@ const initialState = window.__INITIAL_STATE__;
2020

2121
const store = configureStore(initialState);
2222

23-
// Add a banner to the page
24-
const banner = document.createElement('div');
25-
banner.id = 'processing-banner';
26-
document.body.appendChild(banner);
23+
if (
24+
window.location.href.indexOf('full') === -1 &&
25+
window.location.href.indexOf('embed') === -1
26+
) {
27+
// Add a banner to the page
28+
const banner = document.createElement('div');
29+
banner.id = 'processing-banner';
30+
document.body.appendChild(banner);
2731

28-
const link = document.createElement('link');
29-
link.rel = 'stylesheet';
30-
link.href = 'https://foundation-donate-banner.netlify.app/static/css/main.css';
31-
document.head.appendChild(link);
32+
const link = document.createElement('link');
33+
link.rel = 'stylesheet';
34+
link.href =
35+
'https://foundation-donate-banner.netlify.app/static/css/main.css';
36+
document.head.appendChild(link);
3237

33-
const script = document.createElement('script');
34-
script.src = 'https://foundation-donate-banner.netlify.app/static/js/main.js';
35-
document.body.appendChild(script);
38+
const script = document.createElement('script');
39+
script.src = 'https://foundation-donate-banner.netlify.app/static/js/main.js';
40+
document.body.appendChild(script);
3641

37-
if (window.location.href.indexOf('full') === -1) {
3842
const buttonScript = document.createElement('script');
3943
buttonScript.type = 'text/javascript';
4044
buttonScript.defer = true;

client/modules/IDE/components/Header/MobileNav.jsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,16 @@ const MoreMenu = () => {
437437
<MobileMenuItem onClick={() => dispatch(newFolder(rootFile.id))}>
438438
{t('Nav.Sketch.AddFolder')}
439439
</MobileMenuItem>
440-
{/* TODO: Add Translations */}
441-
<b>Settings</b>
440+
<b>{t('MobilePreferences.Settings')}</b>
442441
<MobileMenuItem
443442
onClick={() => {
444443
dispatch(openPreferences());
445444
}}
446445
>
447-
Preferences
446+
{t('MobilePreferences.Preferences')}
448447
</MobileMenuItem>
449448
<MobileMenuItem onClick={() => setIsLanguageModalVisible(true)}>
450-
Language
449+
{t('MobilePreferences.Language')}
451450
</MobileMenuItem>
452451
<b>{t('Nav.Help.Title')}</b>
453452
<MobileMenuItem onClick={() => dispatch(showKeyboardShortcutModal())}>

client/modules/IDE/components/SketchList.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ const SketchList = ({
148148
context: mobile ? 'mobile' : ''
149149
})
150150
)}
151-
{userIsOwner && renderFieldHeader('visibility', 'Visibility')}
151+
{userIsOwner &&
152+
renderFieldHeader('visibility', t('Visibility.Label'))}
152153
<th scope="col"></th>
153154
</tr>
154155
</thead>

client/modules/User/components/VisibilityDropdown.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState, useRef, useEffect } from 'react';
22
import PropTypes from 'prop-types';
3+
import { useTranslation } from 'react-i18next';
34
import LockIcon from '../../../images/lock.svg';
45
import EarthIcon from '../../../images/earth.svg';
56
import CheckmarkIcon from '../../../images/checkmark.svg';
@@ -8,18 +9,20 @@ const VisibilityDropdown = ({ sketch, onVisibilityChange, location }) => {
89
const [isOpen, setIsOpen] = useState(false);
910
const dropdownRef = useRef(null);
1011

12+
const { t } = useTranslation();
13+
1114
const visibilityOptions = [
1215
{
1316
value: 'Public',
14-
label: 'Public',
17+
label: t('Visibility.Public.Label'),
1518
icon: <EarthIcon className="visibility-icon" />,
16-
description: 'Anyone can see this sketch'
19+
description: t('Visibility.Public.Description')
1720
},
1821
{
1922
value: 'Private',
20-
label: 'Private',
23+
label: t('Visibility.Private.Label'),
2124
icon: <LockIcon className="visibility-icon" />,
22-
description: 'Only you can see this sketch'
25+
description: t('Visibility.Private.Description')
2326
}
2427
];
2528

contributor_docs/accessibility.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Here is a guide on [how to use the accessible editor](https://gist.github.com/Ma
44

55
The code for the p5.js web editor adheres to web accessibility standards. The following guidelines will help to ensure that accessibility continues to be a priority as development continues.
66

7+
## Screen Reader and Keyboard Access
78
**Code Structure**
89

910
* Screen Readers are an assistive technology for vision loss that helps users to navigate a web page. They are able to prioritize content based on the semantic meaning of HTML tags. Therefore, it is important to use specific tags, such as `nav`, `ul`, `li`, `section`, and so on. `div` is the least screen reader-friendly tag. For example, [here is the semantic meaning of the `body` tag](http://html5doctor.com/element-index/#body)
@@ -17,4 +18,45 @@ The code for the p5.js web editor adheres to web accessibility standards. The fo
1718
* All `<table>`s need to have a `summary` attribute. This will ensure user is given context to what the table is. [code example](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/modules/IDE/components/SketchList.jsx#L491)
1819
* `ul`s and `nav`s menus need to include a title. [code example](https://github.com/processing/p5.js-web-editor/blob/edae248eede21d7ad7702945929efbcdfeb4d9ea/client/components/Nav.jsx#L281)
1920

20-
For more information on accessibility see the [teach access tutorial](https://teachaccess.github.io/tutorial/)
21+
22+
## Color Blind and Low-Vision Accessibility
23+
24+
To make the editor accessible to color blind and low-vision users, it is important to adhere to the [WCAG 2.2 accessibility guidelines](https://www.w3.org/TR/WCAG22/) relating to adequate color contrast and the use of color to convey information.
25+
26+
**Contrast**
27+
28+
* The [WCAG 2.2 accessibility guidelines](https://www.w3.org/TR/WCAG22/) include guidelines [1.4.3: Perceivable - Contrast (minimum)](https://www.w3.org/TR/WCAG22/#contrast-minimum) and [1.4.11: Perceivable - Non-text Contrast](https://www.w3.org/TR/WCAG22/#non-text-contrast). The guideline for contrast is to ensure that color blind and low-vision users are able to visually distinguish elements that are different colors from one another.
29+
30+
* These guidelines specify the AA standard of contrast ratios between the foreground and background of different types of text, images, and UI components.
31+
32+
* Small text (above 14pt and below 18pt and not bold) must have a contrast ratio of at least 4.5:1
33+
* [Large text](https://www.w3.org/TR/WCAG22/#dfn-large-scale) (above 18 pt regular/14 pt bold or roughly 1.2-1.5em) must have a contrast ratio of at least 3:1
34+
* UI components must have a contrast ratio of at least 3:1 against all adjacent colors
35+
* The color marking the state of UI components (ie active vs inactive) must have a contrast ratio of at least 3:1 relative to each other
36+
* Graphics that are required for understanding content must have a contrast ratio of at least 3:1 against all adjacent colors
37+
* Text or images of text that are part of an inactive user interface component, that are pure decoration, that are not visible to anyone, or that are part of a picture that contains significant other visual content, have no contrast requirement.
38+
* Text that is part of a logo or brand name has no contrast requirement.
39+
40+
* The [Colour Contrast Analyser](https://www.tpgi.com/color-contrast-checker/) tool by TPGi is a downloadable app that allows you to check color contrast and see if it complies with requirements for small text, large text, and GUI elements.
41+
42+
* It is recommended that you adhere to the codelens color palettes (light, dark, and contrast) when contributing to the p5 editor, which define different colors for different parts of the GUI. These colors can be found in client/styles/components/abstracts/variables.scss. Many components come with color defaults that use theme-wide color styles. Some color combinations within the palettes meet foreground/background contrast requirements and others do not, so it is important to check them.
43+
* A p5 editor contributor [(Izzy Snyder)]([url](https://github.com/Izzy-Snyder)) created a tool to check which colors in the editor palette do and do not comply with contrast standards. You can [check out the Github Repository]([url](https://github.com/Izzy-Snyder/contrast-palette-checker)) to try it out yourself.
44+
45+
**Use of Color**
46+
* The [WCAG 2.2 accessibility guidelines](https://www.w3.org/TR/WCAG22/) include [guideline 1.4.1 - perceivable: use of color](https://www.w3.org/TR/WCAG22/#use-of-color). This guideline states that “Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element.”
47+
* Essentially, information that the user needs to be aware of such as the presence of links, the state of buttons, and the presence of errors should not be communicated through color (hue) differences alone. Additionally, the user must not be expected to correctly identify a specific color to use the site (e.g saying “errors are marked in red”).
48+
* This does not mean color cannot be used to convey information - that is great design practice! However, that information should also be conveyed in an additional way.
49+
* Ways to convey information include:
50+
* [using text labels in addition to color](https://www.w3.org/WAI/WCAG22/Techniques/general/G14)
51+
* [using additional non-color styling cues](https://www.w3.org/WAI/WCAG22/Techniques/general/G182) such as underlining or bolding text to differentiate links from surrounding text
52+
* [using different fill patterns](https://www.w3.org/WAI/WCAG22/Techniques/general/G111) to differentiate GUI elements
53+
*[using appropriate contrast](https://www.w3.org/WAI/WCAG22/Techniques/general/G183) (meaning differences in lightness/darkness instead of just hue) between differently colored elements.
54+
* Using styling that is completely unrelated to color is often the most straightforward way to meet this guideline, compared to color contrast which requires more attention to detail on a per-component basis to implement and maintain.
55+
56+
## Accessible web design resources
57+
* For more information on accessibility see the [teach access tutorial](https://teachaccess.github.io/tutorial/)
58+
* [WCAG 2.2 Guidelines](https://www.w3.org/WAI/WCAG22/quickref)
59+
* [Checklist - The A11Y Project](https://www.a11yproject.com/checklist/) - a basic accessibility checklist based on the WCAG 2.2 guidelines
60+
* [Resources - The A11Y Project](https://www.a11yproject.com/resources/) - resource library including articles, tools, and classes on accessible web design.
61+
* [Deque University](https://dequeuniversity.com/) - classes and articles on accessible design
62+
* [Color accessibility beyond a pass/fail by Lauren Jong](https://medium.com/san-francisco-digital-services/color-accessibility-beyond-a-pass-fail-2ea19be4b3c1) - a more nuanced case study on designing for accessibility with regard to color

package-lock.json

Lines changed: 19 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p5.js-web-editor",
3-
"version": "2.18.1",
3+
"version": "2.18.2",
44
"description": "The web editor for p5.js.",
55
"scripts": {
66
"clean": "rimraf dist",
@@ -205,7 +205,7 @@
205205
"@redux-devtools/log-monitor": "^4.0.2",
206206
"@reduxjs/toolkit": "^1.9.3",
207207
"async": "^3.2.3",
208-
"axios": "^1.8.2",
208+
"axios": "^1.12.1",
209209
"babel-plugin-styled-components": "^1.13.2",
210210
"bcryptjs": "^2.4.3",
211211
"blob-util": "^1.2.1",

server/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"target": "ES2022",
55
"module": "commonjs",
66
"lib": ["ES2022"],
7-
"types": ["node", "jest"],
7+
"types": ["node", "jest"]
88
},
99
"include": ["./**/*"],
1010
"exclude": ["../node_modules", "../client"]
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
/**
2-
* generate file system safe string for a given string
2+
* generate file system safe string for a given name
33
* that can be used as a valid file name
44
* in all operating systems
5-
* @param {String} string
5+
* @param {String} originalName
66
* @param {String} replacer (optional) character to replace invalid characters
77
*/
8-
export function generateFileSystemSafeName(string: string, replacer: string) {
8+
export function generateFileSystemSafeName(
9+
originalName: string,
10+
replacer: string
11+
) {
912
// from here https://serverfault.com/a/242134
1013
const INVALID_CHARS_REGEX = /[*/?:\\<>|"\u0000-\u001F]/g; // eslint-disable-line
11-
const slug = string.replace(INVALID_CHARS_REGEX, replacer || '');
14+
const slug = originalName.replace(INVALID_CHARS_REGEX, replacer || '');
1215

1316
return slug;
1417
}

0 commit comments

Comments
 (0)