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

feat: add accessibility improvements for target #7

Merged
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
2 changes: 1 addition & 1 deletion src/app/LightboxStories.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ class LightboxStoriesWrapper extends PureComponent {
<ModalDialog.Body style={modalBodyStyle}>
<div ref={this.containerRef} {...handlers}>
{activeStory && (
<div className="Story-Image" style={{ height: "100%" }}>
<div className="Story-Image" style={{ height: "100%" }} tabIndex={activeStory.media.mediaType === "video" ? 0 : -1}>
<LightboxStoryPhoto
activeStory={activeStory}
containerRef={this.containerRef}
Expand Down
8 changes: 6 additions & 2 deletions src/app/LightboxStoryPhoto.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ const organizationTitleStyles = {
`
};

const Title = styled.h1`
const Title = styled.h2`
color: #5c5f67;
font-family: ${font};
font-size: 20px;
font-weight: 500;
line-height: 1.1;
letter-spacing: 0;
margin: 0 0 0 12px;
Expand Down Expand Up @@ -644,7 +648,7 @@ const LightboxStoryPhoto = ({
</GalleryLightboxParentTitleContainer>
</GalleryLightboxTitleContainer>
)}
<Hr />
<Hr aria-hidden="true" />

{creator && (
<GalleryLightBoxCreatorContainer>
Expand Down
50 changes: 28 additions & 22 deletions src/app/StoriesSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@
&& currentPagination.currentPage !== currentPagination.totalPages) {
if (!appending) {
setAppending(true);
makeGet("/landing_pages/stories", { ...filters, page: currentPagination.currentPage + 2, pageSize: 10 })
makeGet("/landing_pages/stories", { ...filters, page: currentPagination.currentPage + 1, pageSize: 10 })
.then(({ stories: newStories, pagination: newPagination }) => {
setCurrentStories([...currentStories, ...newStories.map((story) => new CHQStory(story))]);
setCurrentPagination(newPagination);
Expand All @@ -417,7 +417,7 @@
}
}
},
[slideLayout.right, currentPagination, currentStories, appending]

Check warning on line 420 in src/app/StoriesSlider.js

View workflow job for this annotation

GitHub Actions / CI

React Hook useEffect has a missing dependency: 'filters'. Either include it or remove the dependency array
);

const trackData = (eventAction, storyId = undefined) =>
Expand Down Expand Up @@ -491,6 +491,13 @@
return story.thumbFullUrl;
};

const storyAriaLabel = (storyIndex) => {
const { question, media } = currentStories[storyIndex];
const baseLabel = `${question.question}, carousel item ${storyIndex + 1} of ${currentStories.length}`;
return media.mediaType === "video" ? `${baseLabel}. Play video. Opens in a modal` : baseLabel;
};


return (
<>
{activeStory && (
Expand Down Expand Up @@ -528,26 +535,6 @@
/>
</svg>
</LeftArrow>
<RightArrow
aria-label="Next"
type="button"
onClick={onNext}
organizationName={organizationName}
style={{ display: slideLayout.right ? "block" : "none" }}
>
<svg
aria-hidden="true"
role="presentation"
width="22px"
height="22px"
viewBox="0 0 1024 1024"
>
<path
transform="translate(0 0)"
d="M596.6 512v0 0l-334.4-348.2c-8.4-8.6-8.2-22.8 0.4-31.6l59.8-61.2c8.6-8.8 22.6-9 31-0.4l408.4 425.4c4.4 4.4 6.4 10.4 6 16.2 0.2 6-1.8 11.8-6 16.2l-408.4 425.2c-8.4 8.6-22.4 8.4-31-0.4l-59.8-61.2c-8.6-8.8-8.8-23-0.4-31.6l334.4-348.4z"
/>
</svg>
</RightArrow>
<ScrollbarContainer ref={containerRef} organizationName={organizationName}>
<div
ref={sliderRef}
Expand All @@ -559,7 +546,7 @@
>
{currentStories.map((story, storyIndex) => (
<Card
aria-labelledby={story.id}
aria-label={storyAriaLabel(storyIndex)}
key={story.id}
style={{ backgroundImage: `url(${backgroundImage(story)})`, width: cardWidth(), maxWidth: maxCardWidth() }}
onClick={() => handleThumbnailClick(storyIndex)}
Expand Down Expand Up @@ -616,6 +603,25 @@
))}
</div>
</ScrollbarContainer>
<RightArrow
aria-label="Next"
type="button"
onClick={onNext}
style={{ display: slideLayout.right ? "block" : "none" }}
>
<svg
aria-hidden="true"
role="presentation"
width="22px"
height="22px"
viewBox="0 0 1024 1024"
>
<path
transform="translate(0 0)"
d="M596.6 512v0 0l-334.4-348.2c-8.4-8.6-8.2-22.8 0.4-31.6l59.8-61.2c8.6-8.8 22.6-9 31-0.4l408.4 425.4c4.4 4.4 6.4 10.4 6 16.2 0.2 6-1.8 11.8-6 16.2l-408.4 425.2c-8.4 8.6-22.4 8.4-31-0.4l-59.8-61.2c-8.6-8.8-8.8-23-0.4-31.6l334.4-348.4z"
/>
</svg>
</RightArrow>
</SliderContainer>
</>
);
Expand Down
Loading