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

Overlay option added in exercise component and new component IncludeRemoveQuestion created #86

Merged
merged 5 commits into from
Jan 27, 2025

Conversation

jomcarvajal
Copy link

Card: https://openstax.atlassian.net/browse/CORE-675

Changes for Exercise Preview card added. New properties to active Overlay and new component IncludeRemoveQuestion with 2 variants.

Screen.Recording.2025-01-17.at.4.14.04.PM.mov

@jomcarvajal jomcarvajal requested a review from a team as a code owner January 20, 2025 15:57
@jomcarvajal jomcarvajal requested review from bethshook and removed request for a team January 20, 2025 15:57
@@ -87,9 +87,6 @@ const StepCardHeader = styled.div`
button.ox-icon-angle-left, button.ox-icon-angle-right {
display: none;
}
.separator {
Copy link
Author

Choose a reason for hiding this comment

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

This style was causing an error for lg display

Copy link
Member

@jivey jivey Jan 21, 2025

Choose a reason for hiding this comment

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

Yeah this should be fixed in #85

Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

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

Overall looking good, just a few small things and the focus ref

@@ -87,9 +87,6 @@ const StepCardHeader = styled.div`
button.ox-icon-angle-left, button.ox-icon-angle-right {
display: none;
}
.separator {
Copy link
Member

@jivey jivey Jan 21, 2025

Choose a reason for hiding this comment

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

Yeah this should be fixed in #85

src/components/Exercise/index.tsx Outdated Show resolved Hide resolved
src/components/Exercise/index.tsx Outdated Show resolved Hide resolved
src/components/IncludeRemoveQuestion.spec.tsx Outdated Show resolved Hide resolved
src/components/IncludeRemoveQuestion/index.tsx Outdated Show resolved Hide resolved
src/components/IncludeRemoveQuestion/styles.ts Outdated Show resolved Hide resolved
src/components/IncludeRemoveQuestion/styles.ts Outdated Show resolved Hide resolved
Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

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

Looks good but wondering about the hover ref and a tabindex question

@@ -195,15 +213,32 @@ export const Exercise = styled(({
{...(exerciseIcons ? { exerciseIcons: exerciseIcons } : null)}
className={props.className}
>
<div ref={container}>
<div
ref={hoverRef}
Copy link
Member

Choose a reason for hiding this comment

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

I think these need to be swapped right? So the hover happens anywhere inside the card? I think that also means that the tabindex needs to be placed on the TaskStepCardWithToolbar

Copy link
Author

Choose a reason for hiding this comment

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

You're right

Copy link
Author

Choose a reason for hiding this comment

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

Well actually, while I'm changing this, I see that TaskStepCardWithToolbar covers more than the visible card:

Screen.Recording.2025-01-23.at.11.32.33.AM.mov

Copy link
Member

Choose a reason for hiding this comment

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

Oh right there's some big margins on that... maybe we add a new wrapper for the toolbar and card body

Copy link
Author

Choose a reason for hiding this comment

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

@jivey
In order to avoid modifications in margins or other styles coming from Card.tsx, I moved the Overlay logic inside Card component. This feature will be enable is a overlayChildren prop is not null and only Exercise can pass that prop for now. I tested that overlay jumps when hover all the card:

Screen.Recording.2025-01-23.at.2.30.54.PM.mov

<div ref={container}>
<div
ref={hoverRef}
tabIndex={enableOverlay ? 0 : -1} // This container is focusable only if enableOverlay is true
Copy link
Member

Choose a reason for hiding this comment

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

Does this cause any side effects for non-overlay exercises in screenreaders? I'm wondering if we should be more conservative and not set the attribute at all for normal use.

src/components/Exercise/index.tsx Outdated Show resolved Hide resolved
@jomcarvajal jomcarvajal requested a review from jivey January 23, 2025 15:26
Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

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

Sorry for all the review rounds, but I just tested this with a screenreader and realized we need to make sure the content under the overlay is not focusable while the overlay is active.

It might also be nice to auto-focus the first control when it activates from tabbing forward only so it doesn't require as many tab presses to navigate.

@jivey
Copy link
Member

jivey commented Jan 24, 2025

@jomcarvajal Fixed my comment, did not mean to mention skipping announcing, as long as the overlay buttons are also read

Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

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

Thanks for the updates! Did this test okay with a screenreader? If so let's go ahead and merge.

@jomcarvajal jomcarvajal merged commit afec494 into preview-card Jan 27, 2025
1 check passed
@jomcarvajal jomcarvajal deleted the CORE-675-include-remove-question-component branch January 27, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants