diff --git a/src/App.jsx b/src/App.jsx
index 82bd8c9..2309d74 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -3,7 +3,7 @@ import BookSearch from "./components/BookSearch";
import BookList from "./components/BookList";
import Header from "./components/Header";
import useFetchBooks from "./hooks/useFetchBooks";
-import CenterdSpinner from "./components/CenteredSpinner";
+import CenteredSpinner from "./components/CenteredSpinner";
import "./App.css";
const App = () => {
@@ -13,6 +13,7 @@ const App = () => {
language: "en",
sortType: "relevance",
});
+
const { books, loading, error, success } = useFetchBooks(searchParams);
const handleSearch = (searchValue, searchType, language, sortType) => {
@@ -20,11 +21,11 @@ const App = () => {
};
return (
-
+
{/* Indicate main content for assistive technologies */}
- {loading &&
}
- {error &&
Error: {error.message}
}
+ {loading &&
}
+ {error &&
Error: {error.message}
} {/* Announce error messages */}
{success &&
}
);
diff --git a/src/components/BookItem.jsx b/src/components/BookItem.jsx
index aa773e0..704368f 100644
--- a/src/components/BookItem.jsx
+++ b/src/components/BookItem.jsx
@@ -22,13 +22,20 @@ export default function BookItem({ book }) {
return (
-
+ { if (e.key === 'Enter') handleOpen(); }} // Allow keyboard activation
+ aria-label={`View details for ${title} by ${authors?.join(", ")}`} // Provide an accessible label
+ >
-
+ { if (e.key === 'Enter') handleOpen(); }} // Allow keyboard activation
+ />
@@ -51,14 +54,8 @@ export default function BookItemBack({
{authors?.join(", ")}
-
-
-
-
+ window.open(canonicalVolumeLink, '_blank', 'noopener,noreferrer')}>
+
diff --git a/src/components/BookList.jsx b/src/components/BookList.jsx
index b67b5c9..98af04c 100644
--- a/src/components/BookList.jsx
+++ b/src/components/BookList.jsx
@@ -10,6 +10,7 @@ const BookList = ({ books }) => {
const indexOfFirstBook = indexOfLastBook - booksPerPage;
const currentBooks = books.slice(indexOfFirstBook, indexOfLastBook);
const paginate = (pageNumber) => setCurrentPage(pageNumber);
+
return (
<>
{
gap: "1rem",
marginBottom: "2rem",
}}
+ role="region" // Indicate this is a region of related content
+ aria-labelledby="book-list-title" // Link to the heading
>
+ Book List
{/* Hidden heading for screen readers */}
{currentBooks.map((book, index) => (
))}
@@ -29,6 +33,8 @@ const BookList = ({ books }) => {
{
alignItems: "center",
marginBottom: 2,
}}
+ role="region" // Indicate this is a search region
+ aria-labelledby="book-search-title" // Link to the title
>
+ Book Search
{/* Hidden heading for screen readers */}
{
InputProps={{
endAdornment: (
-
+ {/* Hide icon from screen readers */}
),
}}
+ aria-label="Search for books" // Provide label for assistive technologies
/>