Skip to content

Commit

Permalink
Re-add jsx-a11y and accessibility fixes (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
js0mmer authored Feb 29, 2024
1 parent c05aa72 commit eb4f3ee
Show file tree
Hide file tree
Showing 20 changed files with 229 additions and 50 deletions.
6 changes: 6 additions & 0 deletions site/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
'plugin:jsx-a11y/recommended',
'prettier',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
Expand All @@ -23,4 +24,9 @@ module.exports = {
version: 'detect',
},
},
settings: {
react: {
version: 'detect',
},
},
};
116 changes: 116 additions & 0 deletions site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@vitejs/plugin-react": "^4.0.3",
"eslint": "^8.45.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
Expand Down
6 changes: 6 additions & 0 deletions site/src/component/AppHeader/Profile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
}
}

.profile-button {
background: none;
border: none;
height: 100%;
}

#profile-popover {
font-size: 1rem;
padding: 1em;
Expand Down
6 changes: 5 additions & 1 deletion site/src/component/AppHeader/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ const Profile = () => {
],
}}
>
<img src={picture} alt={name} className="navbar-profile-pic" />
{({ ref, ...triggerHandler }) => (
<button {...triggerHandler} className="profile-button">
<img ref={ref} src={picture} alt={name} className="navbar-profile-pic" />
</button>
)}
</OverlayTrigger>
</div>
) : (
Expand Down
2 changes: 1 addition & 1 deletion site/src/component/Error/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface ErrorProps {
const Error: FC<ErrorProps> = (props) => {
return (
<div className="error">
<img src={noResultsImg}></img>
<img src={noResultsImg} alt="no results"></img>
<h1>404 PAGE NOT FOUND</h1>
<h2>{props.message}</h2>
</div>
Expand Down
18 changes: 6 additions & 12 deletions site/src/component/Report/ReportGroup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@
border-radius: var(--border-radius);
padding: 2rem;
margin-bottom: 3vh;

label {
font-weight: bold;
}
}

.report-group-identifier {
margin: 0;
// font-weight: bold;
font-size: x-large;
// a {
// color: black;
// }
}

.report-group-label {
font-weight: bold;
margin-bottom: 0.5rem;
}

.report-group-user-display {
Expand All @@ -24,10 +21,7 @@

.report-group-content {
margin: 1vh 0;
label {
font-weight: bold;
}
p {
p:nth-child(2) {
font-style: italic;
margin-left: 1vw;
}
Expand Down
4 changes: 2 additions & 2 deletions site/src/component/Report/ReportGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ const ReportGroup: FC<ReportGroupProps> = (props) => {
</div>
</div>
<div className="report-group-content">
<label>Review Content:</label>
<p className="report-group-label">Review Content:</p>
<p>{review.reviewContent}</p>
</div>
<label>Reports on this review:</label>
<p className="report-group-label">Reports on this review:</p>
<div className="report-group-subreports-container">
{props.reports.map((report, i) => {
return (
Expand Down
1 change: 1 addition & 0 deletions site/src/component/SearchModule/SearchModule.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const SearchModule: FC<SearchModuleProps> = ({ index }) => {
</InputGroup.Prepend>
<Form.Control
className="search-bar"
aria-label="search"
type="text"
placeholder={placeholder}
onChange={(e) => searchNamesAfterTimeout(e.target.value)}
Expand Down
2 changes: 1 addition & 1 deletion site/src/component/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const SideBar = () => {

{/* Profile Icon and Name */}
<div className="sidebar-profile">
<img src={picture ? picture : defaultAvatar} />
<img src={picture ? picture : defaultAvatar} alt="profile" />
<p>{name ? name : 'Anonymous Peter'}</p>
</div>

Expand Down
17 changes: 13 additions & 4 deletions site/src/component/SideBar/Sidebar.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[data-theme='dark'] {
.sidebar {
.sidebar-links {
ul li a:hover {
ul li a:hover,
ul li button:hover {
background-color: var(--overlay2);
}
}
Expand Down Expand Up @@ -65,7 +66,8 @@
grid-gap: 10px;
padding: 10px;
}
a:hover {
a:hover,
button:hover {
background: rgba(0, 0, 0, 0.05);
border-radius: 5px;
}
Expand Down Expand Up @@ -115,7 +117,8 @@
li {
margin-top: 2vh;

a {
a,
button {
display: flex;
flex-direction: column;
margin: 0;
Expand Down Expand Up @@ -161,7 +164,8 @@
.sidebar-links {
ul {
li {
a {
a,
button {
span {
font-size: smaller;
}
Expand All @@ -172,6 +176,11 @@
}
}

.theme-toggle {
border: none;
background: none;
}

.theme-toggle:hover {
cursor: pointer;
text-decoration: underline;
Expand Down
7 changes: 6 additions & 1 deletion site/src/pages/RoadmapPage/Course.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ const Course: FC<CourseProps> = (props) => {
{onDelete && (
<ThemeContext.Consumer>
{({ darkMode }) => (
<Button variant={darkMode ? 'dark' : 'light'} className="course-delete-btn" onClick={onDelete}>
<Button
variant={darkMode ? 'dark' : 'light'}
className="course-delete-btn"
onClick={onDelete}
aria-label="delete"
>
<Trash className="course-delete-icon" />
</Button>
)}
Expand Down
Loading

0 comments on commit eb4f3ee

Please sign in to comment.