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

[Frontend] Use sr-only text #692

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 5 additions & 1 deletion frontend/src/components/FullscreenLoading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ export const FullscreenLoading = ({
)}
>
<Loader2
aria-label="Loading"
className="h-16 w-16 animate-spin text-primary"
/>
{!takingLong && (
ozdentarikcan marked this conversation as resolved.
Show resolved Hide resolved
<div className="ml-4 text-lg font-normal duration-500 animate-in fade-in">
Loading...
</div>
)}
{takingLong && (
<div className="ml-4 text-lg font-normal duration-500 animate-in fade-in">
This is taking a while...
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/SearchQuestionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ export const SearchQuestionsList = () => {
{isLoading && (
<div className="col-span-3 flex w-full items-center justify-center">
<Loader2
aria-label="Loading"
className="h-16 w-16 animate-spin text-primary"
/>
<div className="ml-4 text-lg font-normal duration-500 animate-in fade-in">
Loading...
</div>
</div>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/SearchTagsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ export const SearchTagsList = () => {
{isLoading && (
<div className="col-span-3 flex w-full items-center justify-center">
<Loader2
aria-label="Loading"
className="h-16 w-16 animate-spin text-primary"
/>
<div className="ml-4 text-lg font-normal duration-500 animate-in fade-in">
Loading...
</div>
</div>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/Tags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ export default function TagsPage() {
{isLoading && (
<div className="col-span-3 flex w-full items-center justify-center">
<Loader2
aria-label="Loading"
className="h-16 w-16 animate-spin text-primary"
/>
<div className="ml-4 text-lg font-normal duration-500 animate-in fade-in">
Loading...
</div>
</div>
)}
</div>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/routes/bookmarks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ export const BookmarkedQuestions = () => {
{isLoading && (
<div className="col-span-3 flex w-full items-center justify-center">
<Loader2
aria-label="Loading"
className="h-16 w-16 animate-spin text-primary"
/>
<div className="ml-4 text-lg font-normal duration-500 animate-in fade-in">
Loading...
</div>
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/profile.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("Profile component", () => {

render(<RouterProvider router={router} />);

expect(screen.getByLabelText(/loading/i)).toBeInTheDocument();
expect(screen.getByText("Loading...")).toBeInTheDocument();
});

it("displays user data correctly", async () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/search.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("Search component", () => {
</MemoryRouter>,
);

expect(screen.getByLabelText(/loading/i)).toBeInTheDocument();
expect(screen.getByText("Loading...")).toBeInTheDocument();
});

it("renders tags correctly", () => {
Expand Down
13 changes: 4 additions & 9 deletions frontend/src/routes/tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,9 @@ export default function TagPage() {
</div>
<div className="grid grid-cols-2 gap-4">
{tag.fileExtension && (
<div
className="flex items-center gap-2"
aria-label={`File extension for ${tag.name} is ${tag.fileExtension}`}
>
<div className="flex items-center gap-2">
<FileText className="h-5 w-5" />

<span className="sr-only">File extension for ${tag.name} is ${tag.fileExtension}</span>
<span className="text-sm text-gray-500">{tag.fileExtension}</span>
</div>
)}
Expand All @@ -146,14 +143,12 @@ export default function TagPage() {
)}

{tag.inceptionYear && (
<div
className="flex items-center gap-2"
aria-label={`Inception year for ${tag.name} is ${tag.inceptionYear}`}
>
<div className="flex items-center gap-2">
<Calendar className="h-5 w-5" />
<span className="text-sm text-gray-500">
Created in {new Date(tag.inceptionYear).toLocaleDateString()}
</span>
<span className="sr-only"> Inception year for ${tag.name} is ${tag.inceptionYear} </span>
</div>
)}

Expand Down
Loading