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

New DTI Website: Use Details/Summary For FAQ Accordion #746

Merged
merged 2 commits into from
Nov 29, 2024

Conversation

andrew032011
Copy link
Collaborator

Summary

For the FAQ accordion here, we should use the <details> and <summary> tags. See this MDN article for details.

Notion/Figma Link

Part of #734

Test Plan

Verify FAQ Accordion looks and behaves the same as before.

Notes

Breaking Changes

@andrew032011 andrew032011 requested a review from a team as a code owner November 29, 2024 01:20
@dti-github-bot
Copy link
Member

dti-github-bot commented Nov 29, 2024

[diff-counting] Significant lines: 46.

}

details {
user-select: none;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Clicking on the accordian a few times in a row leads to some of the summary text getting highlighted, which is a regression from previous behavior. So I made the details not selectable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

hmmm...

i'm usually wary of using user-select: none; because it removes a functionality for the user (being able to select and copy an FAQ question), which might be something a user usually expects.

This StackExchange post goes more into detail about the possible drawbacks of using this particular CSS property.

I especially like when they say:

The goal in employing user-select: none should always be limited to reducing user frustration from unintended selections resulting from interaction that can easily cause them when attempting to carry out the primary task purpose of a control it is used on.

I wonder if rapidly clicking the accordion qualifies as the "primary task purpose of a control"? In my own testing when I pulled down the branch, I had to click twice pretty fast in order to have some of the summary text getting highlighted.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I do get ur point tho andrew and it is a shame that using <details> leads to this regression, so if you feel like that adding user-select: none; is worth it in this case, I'll defer to you here.

but let's also make sure that this is an exception bc i dont think we want to make this behavior standard

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I had a feeling it was bad practice. I reverted that part! I agree with you that rapidly clicking might be something we do when testing it, but in practice, we wouldn't do that so I wouldn't consider it to be a "primary task purpose of a control".

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, sounds good then!

@andrew032011 andrew032011 mentioned this pull request Nov 29, 2024
17 tasks
Copy link
Collaborator

@cchrischen cchrischen 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! Since we are standardizing the accordions between the apply page and the course page, we should check to see which design to settle on before merging this one, in case we settle on the courses one.

@andrew032011
Copy link
Collaborator Author

andrew032011 commented Nov 29, 2024

Looks good! Since we are standardizing the accordions between the apply page and the course page, we should check to see which design to settle on before merging this one, in case we settle on the courses one.

I'll surface this in #idol-design.

@andrew032011
Copy link
Collaborator Author

Looks good! Since we are standardizing the accordions between the apply page and the course page, we should check to see which design to settle on before merging this one, in case we settle on the courses one.

I'll surface this in #idol-design.

Vannessa brought up a good point that the Application and Courses Project Showcase Accordians are for different purposes, so it makes sense to make them different. So we decided not to standardize them.

Copy link
Collaborator

@Bookie0 Bookie0 left a comment

Choose a reason for hiding this comment

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

THanksss!

Comment on lines +12 to +15
<details className="border-white border-b-black border-2 cursor-pointer">
<summary className="section-subheading">{header}</summary>
<div className="md:py-5 xs:py-3">{children}</div>
</details>
Copy link
Collaborator

Choose a reason for hiding this comment

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

yay

}

details {
user-select: none;
Copy link
Collaborator

Choose a reason for hiding this comment

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

hmmm...

i'm usually wary of using user-select: none; because it removes a functionality for the user (being able to select and copy an FAQ question), which might be something a user usually expects.

This StackExchange post goes more into detail about the possible drawbacks of using this particular CSS property.

I especially like when they say:

The goal in employing user-select: none should always be limited to reducing user frustration from unintended selections resulting from interaction that can easily cause them when attempting to carry out the primary task purpose of a control it is used on.

I wonder if rapidly clicking the accordion qualifies as the "primary task purpose of a control"? In my own testing when I pulled down the branch, I had to click twice pretty fast in order to have some of the summary text getting highlighted.

}

details {
user-select: none;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do get ur point tho andrew and it is a shame that using <details> leads to this regression, so if you feel like that adding user-select: none; is worth it in this case, I'll defer to you here.

but let's also make sure that this is an exception bc i dont think we want to make this behavior standard

@andrew032011 andrew032011 merged commit 49ce8c4 into main Nov 29, 2024
17 checks passed
@andrew032011 andrew032011 deleted the axc/code_audit_fixes branch November 29, 2024 05:03
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.

4 participants