Skip to content
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

Adding eslint-plugin-jsx-a11y plugin and general accessibility #1143

Open
wants to merge 1 commit into
base: nextjs
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@next/next/recommended"
"plugin:@next/next/recommended",
"plugin:jsx-a11y/recommended"
],
"rules": {
"react/no-unescaped-entities": 0,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/common/components/NavBarMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const NavbarMain = () => {
)}
</Grid>
<FormControlLabel
aria-label = {`${theme.mode === "dark" ? "Button to toggle between light and dark mode; currently in dark mode" : "Button to toggle between light and dark mode; currently in light mode"}`}
style={{
marginLeft: "auto",
marginRight: 0,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/LearnMod/ClassCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const ClassCard = (props: {
}
>
<div className="circleInFill">
<span className="textInCircle">
<span className="textInCircle" aria-label="Module progress percentage">
{Math.floor((pointsEarned / points) * 100)}%
</span>
</div>
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/features/LearnMod/ModulesSideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const ModulesSideBar = () => {
return (
<li
className="sideBarSubsection"
role="tab"
onClick={() =>
Router.push(
{
Expand All @@ -50,6 +51,15 @@ const ModulesSideBar = () => {
"/LearnContent"
)
}
onKeyDown={() =>
Router.push(
{
pathname: "/LearnContent",
query: sectionSpec,
},
"/LearnContent"
)
}
key={index2}
style={{ color: "white" }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TrainspaceLayout = ({
>
{code}
</SyntaxHighlighter>
<IconButton style={{ position: "absolute", right: 15, top: 5 }}>
<IconButton style={{ position: "absolute", right: 15, top: 5 }} aria-label = "Copy code snippet">
<ContentCopy />
</IconButton>
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const TrainspaceStepInner = ({
</Button>
}
{
isButtonClicked ? <CircularProgress/> : null
isButtonClicked ? <CircularProgress aria-label="Loading"/> : null
}
</Stack>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const TrainspaceStepInner = ({

let trainbuttontext: string | JSX.Element;
if (isButtonClicked) {
trainbuttontext = <CircularProgress />;
trainbuttontext = <CircularProgress aria-label="Loading"/>;
} else {
if (step < TRAINSPACE_SETTINGS.steps.length - 1) {
trainbuttontext = "Next";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/learn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const LearnMod = () => {
<div className="classes">
{content.map((lesson, index) => {
//const moduleProgress = user.userProgressData[lesson.moduleID];

console.log(lesson);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this debug print needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover from testing, will clean up

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. Thanks!

return (
<ClassCard
user={user}
Expand Down
58 changes: 58 additions & 0 deletions frontend/src/pages/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ const SettingsBlock = () => {
</Form.Group>
<div
className="email-buttons d-flex flex-column"
role = "button"
tabIndex={0}
onClick={async () => {
Promise.allSettled([
(async () => {
Expand Down Expand Up @@ -122,6 +124,62 @@ const SettingsBlock = () => {
})(),
]);
}}
onKeyDown={async () => {
Promise.allSettled([
(async () => {
if (fullName) {
try {
await dispatch(
updateUserDisplayName({ displayName: fullName })
).unwrap();
toast.success("Successfully updated display name", {
position: toast.POSITION.TOP_CENTER,
});
} catch (e) {
toast.error(
`Display name - ${(e as SerializedError).message}`,
{
position: toast.POSITION.TOP_CENTER,
}
);
}
}
})(),
(async () => {
if (email) {
try {
await dispatch(updateUserEmail({ email })).unwrap();
toast.success("Successfully updated email", {
position: toast.POSITION.TOP_CENTER,
});
} catch (e) {
toast.error(`Email - ${(e as SerializedError).message}`, {
position: toast.POSITION.TOP_CENTER,
});
}
}
})(),
(async () => {
if (password) {
try {
await dispatch(
updateUserPassword({
password,
checkPassword,
})
).unwrap();
toast.success("Successfully updated password", {
position: toast.POSITION.TOP_CENTER,
});
} catch (e) {
toast.error(`Password - ${(e as SerializedError).message}`, {
position: toast.POSITION.TOP_CENTER,
});
}
}
})(),
]);
}}
>
<Button id="update-profile" className="mb-2">
Update Profile
Expand Down
Loading