Skip to content

Commit 0bea803

Browse files
authored
Merge branch 'develop' into issue-processing#2923
2 parents 43853dd + 41d0303 commit 0bea803

File tree

118 files changed

+39694
-41308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+39694
-41308
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"import/named": 0,
1515
"import/namespace": 0,
1616
"import/no-unresolved": 0,
17-
"import/no-named-as-default": 2,
17+
"import/no-named-as-default": 0,
18+
"import/no-named-as-default-member": 0,
1819
"comma-dangle": 0, // not sure why airbnb turned this on. gross!
1920
"indent": 0,
2021
"no-console": 0,

.github/workflows/deploy-staging.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Check out the repo
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v1
24+
uses: docker/setup-buildx-action@v2
2525
- name: Login to Docker Hub
26-
uses: docker/login-action@v1
26+
uses: docker/login-action@v2
2727
with:
2828
username: ${{ secrets.DOCKER_USERNAME }}
2929
password: ${{ secrets.DOCKER_PASSWORD }}
3030
- name: Build and push to Docker Hub
31-
uses: docker/build-push-action@v2
31+
uses: docker/build-push-action@v4
3232
with:
3333
context: .
3434
file: ./Dockerfile

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Check out the repo
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323
with:
2424
ref: release
2525
- name: Set up Docker Buildx
2626
uses: docker/setup-buildx-action@v2
2727
with:
2828
platforms: linux/amd64,linux/arm64
2929
- name: Login to Docker Hub
30-
uses: docker/login-action@v1
30+
uses: docker/login-action@v2
3131
with:
3232
username: ${{ secrets.DOCKER_USERNAME }}
3333
password: ${{ secrets.DOCKER_PASSWORD }}
3434
- name: Build and push to Docker Hub
35-
uses: docker/build-push-action@v2
35+
uses: docker/build-push-action@v4
3636
with:
3737
context: .
3838
file: ./Dockerfile

.storybook/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const config = {
44
addons: [
55
'@storybook/addon-links',
66
'@storybook/addon-essentials',
7-
'@storybook/addon-interactions'
7+
'@storybook/addon-interactions',
8+
'@storybook/addon-mdx-gfm'
89
],
910
framework: {
1011
name: '@storybook/react-webpack5',

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM node:16.14.2 as base
1+
FROM node:16.14.2 AS base
22
ENV APP_HOME=/usr/src/app \
33
TERM=xterm
44
RUN mkdir -p $APP_HOME
55
WORKDIR $APP_HOME
66
EXPOSE 8000
77
EXPOSE 8002
88

9-
FROM base as development
9+
FROM base AS development
1010
ENV NODE_ENV development
1111
COPY package.json package-lock.json ./
1212
RUN npm install
@@ -18,11 +18,11 @@ COPY translations/locales ./translations/locales
1818
COPY public ./public
1919
CMD ["npm", "start"]
2020

21-
FROM development as build
21+
FROM development AS build
2222
ENV NODE_ENV production
2323
RUN npm run build
2424

25-
FROM base as production
25+
FROM base AS production
2626
ENV NODE_ENV=production
2727
COPY package.json package-lock.json index.js ./
2828
RUN npm install --production

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,9 @@ Make your first sketch in the [p5.js Editor](https://editor.p5js.org/)! Learn mo
2222
If you have found a bug in the p5.js Web Editor, you can file it under the ["issues" tab](https://github.com/processing/p5.js-web-editor/issues). You can also request new features here. A set of templates for reporting issues and requesting features are provided to assist you (and us!). The p5.js Editor is maintained mostly by volunteers, so we thank you for your patience as we try to address your issues as soon as we can. Please post bugs and feature requests in the correct repository if you can:
2323

2424
* p5.js library: [https://github.com/processing/p5.js/issues](https://github.com/processing/p5.js/issues)
25-
* p5.accessibility: [https://github.com/processing/p5.accessibility/issues](https://github.com/processing/p5.accessibility/issues)
26-
* p5.sound: [https://github.com/processing/p5.js-sound/issues](https://github.com/processing/p5.js-sound/issues)
2725
* p5.js website: [https://github.com/processing/p5.js-website/issues](https://github.com/processing/p5.js-website/issues)
2826

2927

30-
### How Do I Know My Issue or Pull Request is Getting Reviewed?
31-
32-
To see which pull requests and issues are currently being reviewed, check the [PR Review Board](https://github.com/processing/p5.js-web-editor/projects/9) or the following Milestones: [MINOR Release](https://github.com/processing/p5.js-web-editor/milestone/8).
33-
34-
3528
## References for Contributing to the p5.js Web Editor
3629

3730
[Code of Conduct](https://editor.p5js.org/code-of-conduct)

client/common/useKeyDownHandlers.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ export default function useKeyDownHandlers(keyHandlers) {
3333
const isMac = navigator.userAgent.toLowerCase().indexOf('mac') !== -1;
3434
const isCtrl = isMac ? e.metaKey : e.ctrlKey;
3535
if (e.shiftKey && isCtrl) {
36-
handlers.current[`ctrl-shift-${e.key.toLowerCase()}`]?.(e);
36+
handlers.current[
37+
`ctrl-shift-${
38+
/^\d+$/.test(e.code.at(-1)) ? e.code.at(-1) : e.key.toLowerCase()
39+
}`
40+
]?.(e);
41+
} else if (isCtrl && e.altKey && e.code === 'KeyN') {
42+
// specifically for creating a new file
43+
handlers.current[`ctrl-alt-n`]?.(e);
3744
} else if (isCtrl) {
3845
handlers.current[`ctrl-${e.key.toLowerCase()}`]?.(e);
3946
}

client/components/Dropdown/DropdownMenu.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const DropdownMenu = forwardRef(
3838
};
3939

4040
return (
41-
<div ref={anchorRef} className={className}>
41+
<div ref={anchorRef} className={className} aria-haspopup="menu">
4242
<button
4343
className={classes.button}
4444
aria-label={ariaLabel}
@@ -51,6 +51,7 @@ const DropdownMenu = forwardRef(
5151
</button>
5252
{isOpen && (
5353
<DropdownWrapper
54+
role="menu"
5455
className={classes.list}
5556
align={align}
5657
onMouseUp={() => {

client/components/Dropdown/MenuItem.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function MenuItem({ hideIf, ...rest }) {
1010
}
1111

1212
return (
13-
<li>
13+
<li role="menuitem">
1414
<ButtonOrLink {...rest} />
1515
</li>
1616
);

client/components/Nav/NavBar.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ function NavBar({ children, className }) {
6969
return (
7070
<NavBarContext.Provider value={contextValue}>
7171
<header>
72-
<nav className={className} ref={nodeRef}>
72+
<div className={className} ref={nodeRef}>
7373
<MenuOpenContext.Provider value={dropdownOpen}>
7474
{children}
7575
</MenuOpenContext.Provider>
76-
</nav>
76+
</div>
7777
</header>
7878
</NavBarContext.Provider>
7979
);

client/components/Nav/NavDropdownMenu.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,20 @@ function NavDropdownMenu({ id, title, children }) {
2424

2525
return (
2626
<li className={classNames('nav__item', isOpen && 'nav__item--open')}>
27-
<button {...handlers}>
27+
<button
28+
{...handlers}
29+
role="menuitem"
30+
aria-haspopup="menu"
31+
aria-expanded={isOpen}
32+
>
2833
<span className="nav__item-header">{title}</span>
2934
<TriangleIcon
3035
className="nav__item-header-triangle"
3136
focusable="false"
3237
aria-hidden="true"
3338
/>
3439
</button>
35-
<ul className="nav__dropdown">
40+
<ul className="nav__dropdown" role="menu">
3641
<ParentMenuContext.Provider value={id}>
3742
{children}
3843
</ParentMenuContext.Provider>

client/components/Nav/NavMenuItem.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function NavMenuItem({ hideIf, className, ...rest }) {
1919

2020
return (
2121
<li className={className}>
22-
<ButtonOrLink {...rest} {...handlers} />
22+
<ButtonOrLink {...rest} {...handlers} role="menuitem" />
2323
</li>
2424
);
2525
}

client/components/PreviewNav.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ const PreviewNav = ({ owner, project }) => {
1212
<nav className="nav preview-nav">
1313
<div className="nav__items-left">
1414
<div className="nav__item-logo">
15-
<LogoIcon
16-
role="img"
17-
aria-label={t('Common.p5logoARIA')}
18-
focusable="false"
19-
className="svg__logo"
20-
/>
15+
<Link to={`/${owner.username}/sketches`}>
16+
<LogoIcon
17+
role="img"
18+
aria-label={t('Common.p5logoARIA')}
19+
focusable="false"
20+
className="svg__logo"
21+
/>
22+
</Link>
2123
</div>
2224
<Link
2325
className="nav__item"

client/components/RootPage.jsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const RootPage = styled.div`
1414
height: 100%;
1515
overflow: hidden;
1616
}
17+
@media print {
18+
@page {
19+
page-orientation: landscape;
20+
}
21+
}
1722
`;
1823

1924
export default RootPage;

client/components/SkipLink.jsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React, { useState } from 'react';
2+
import classNames from 'classnames';
3+
import PropTypes from 'prop-types';
4+
import { useTranslation } from 'react-i18next';
5+
6+
const SkipLink = ({ targetId, text }) => {
7+
const [focus, setFocus] = useState(false);
8+
const { t } = useTranslation();
9+
const handleFocus = () => {
10+
setFocus(true);
11+
};
12+
13+
const handleBlur = () => {
14+
setFocus(false);
15+
};
16+
const linkClasses = classNames('skip_link', { focus });
17+
18+
return (
19+
<a
20+
href={`#${targetId}`}
21+
className={linkClasses}
22+
onFocus={handleFocus}
23+
onBlur={handleBlur}
24+
>
25+
{t(`SkipLink.${text}`)}
26+
</a>
27+
);
28+
};
29+
30+
SkipLink.propTypes = {
31+
targetId: PropTypes.string.isRequired,
32+
text: PropTypes.string.isRequired
33+
};
34+
35+
export default SkipLink;

client/components/createRedirectWithUsername.jsx

Lines changed: 0 additions & 29 deletions
This file was deleted.

client/constants.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,9 @@ export const SET_BLOB_URL = 'SET_BLOB_URL';
5252
export const EXPAND_SIDEBAR = 'EXPAND_SIDEBAR';
5353
export const COLLAPSE_SIDEBAR = 'COLLAPSE_SIDEBAR';
5454

55-
export const CONSOLE_EVENT = 'CONSOLE_EVENT';
56-
export const CLEAR_CONSOLE = 'CLEAR_CONSOLE';
5755
export const EXPAND_CONSOLE = 'EXPAND_CONSOLE';
5856
export const COLLAPSE_CONSOLE = 'COLLAPSE_CONSOLE';
5957

60-
export const UPDATE_LINT_MESSAGE = 'UPDATE_LINT_MESSAGE';
61-
export const CLEAR_LINT_MESSAGE = 'CLEAR_LINT_MESSAGE';
6258
export const TOGGLE_FORCE_DESKTOP = 'TOGGLE_FORCE_DESKTOP';
6359

6460
export const UPDATE_FILE_NAME = 'UPDATE_FILE_NAME';
@@ -140,3 +136,6 @@ export const START_SAVING_PROJECT = 'START_SAVING_PROJECT';
140136
export const END_SAVING_PROJECT = 'END_SAVING_PROJECT';
141137

142138
export const SET_COOKIE_CONSENT = 'SET_COOKIE_CONSENT';
139+
140+
export const CONSOLE_EVENT = 'CONSOLE_EVENT';
141+
export const CLEAR_CONSOLE = 'CLEAR_CONSOLE';

client/index.integration.test.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ describe('index.jsx integration', () => {
7373
});
7474

7575
it('navbar items and the dropdowns in the navbar exist', () => {
76-
const navigation = screen.getByRole('navigation');
76+
const navigation = screen.getByRole('menubar');
7777
expect(navigation).toBeInTheDocument();
7878

79-
const fileButton = within(navigation).getByRole('button', {
79+
const fileButton = within(navigation).getByRole('menuitem', {
8080
name: /^file$/i
8181
});
8282
expect(fileButton).toBeInTheDocument();
8383

84-
const newFileButton = within(navigation).getByRole('button', {
84+
const newFileButton = within(navigation).getByRole('menuitem', {
8585
name: /^new$/i
8686
});
8787
expect(newFileButton).toBeInTheDocument();
@@ -91,17 +91,17 @@ describe('index.jsx integration', () => {
9191
// const exampleFileButton = within(navigation).getByRole('link', {name: /^examples$/i});
9292
// expect(exampleFileButton).toBeInTheDocument();
9393

94-
const editButton = within(navigation).getByRole('button', {
94+
const editButton = within(navigation).getByRole('menuitem', {
9595
name: /^edit$/i
9696
});
9797
expect(editButton).toBeInTheDocument();
9898

99-
const sketchButton = within(navigation).getByRole('button', {
99+
const sketchButton = within(navigation).getByRole('menuitem', {
100100
name: /^sketch$/i
101101
});
102102
expect(sketchButton).toBeInTheDocument();
103103

104-
const helpButton = within(navigation).getByRole('button', {
104+
const helpButton = within(navigation).getByRole('menuitem', {
105105
name: /^help$/i
106106
});
107107
expect(helpButton).toBeInTheDocument();

client/index.jsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Routing from './routes';
99
import ThemeProvider from './modules/App/components/ThemeProvider';
1010
import Loader from './modules/App/components/loader';
1111
import './i18n';
12+
import SkipLink from './components/SkipLink';
1213

1314
require('./styles/main.scss');
1415

@@ -20,18 +21,21 @@ const initialState = window.__INITIAL_STATE__;
2021
const store = configureStore(initialState);
2122

2223
const App = () => (
23-
<Provider store={store}>
24-
<ThemeProvider>
25-
<Router history={browserHistory}>
26-
<Routing />
27-
</Router>
28-
</ThemeProvider>
29-
</Provider>
24+
<>
25+
<Router history={browserHistory}>
26+
<SkipLink targetId="play-sketch" text="PlaySketch" />
27+
<Routing />
28+
</Router>
29+
</>
3030
);
3131

3232
render(
33-
<Suspense fallback={<Loader />}>
34-
<App />
35-
</Suspense>,
33+
<Provider store={store}>
34+
<ThemeProvider>
35+
<Suspense fallback={<Loader />}>
36+
<App />
37+
</Suspense>
38+
</ThemeProvider>
39+
</Provider>,
3640
document.getElementById('root')
3741
);

0 commit comments

Comments
 (0)