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

[PM-14422] Vault Carousel #12791

Merged
merged 28 commits into from
Jan 22, 2025
Merged

[PM-14422] Vault Carousel #12791

merged 28 commits into from
Jan 22, 2025

Conversation

nick-livefront
Copy link
Collaborator

@nick-livefront nick-livefront commented Jan 9, 2025

🎟️ Tracking

PM-14422

📔 Objective

Adds a Carousel components to Storybook under Vault/Carousel

There is a possibility that an implementation has differing heights across slides, which can result in the controls jumping around vertically. I added an input to provide a set height for the carousel so the controls can be pushed to the bottom.
A couple other ideas:

  • Define a couple set heights that implementations can choose from?
  • Edit: I ended up attempted this one: The carousel component could render each slide invisible to the user and find the max height and then use that as a set height for all slides.

📸 Screenshots

Carousel Carousel Screen Reader
Screen.Recording.2025-01-09.at.2.46.38.PM.mov
carousel-screen-reader.mov

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@nick-livefront nick-livefront requested review from a team as code owners January 9, 2025 20:58
@merissaacosta merissaacosta requested review from vleague2 and removed request for merissaacosta January 9, 2025 21:03
Copy link
Contributor

github-actions bot commented Jan 9, 2025

Logo
Checkmarx One – Scan Summary & Details93c4a9b8-ca63-44b1-9b99-99d001688d9b

New Issues (2)

Checkmarx found the following issues in this Pull Request

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Client_Privacy_Violation /bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.html: 99
detailsMethod all_applications_component at line 99 of /bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.html sends ...
Attack Vector
MEDIUM Client_Privacy_Violation /bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.html: 94
detailsMethod all_applications_component at line 94 of /bitwarden_license/bit-web/src/app/tools/access-intelligence/all-applications.component.html sends ...
Attack Vector
Fixed Issues (1)

Great job! The following issues were fixed in this Pull Request

Severity Issue Source File / Package
MEDIUM Client_Privacy_Violation /bitwarden_license/bit-web/src/app/tools/access-intelligence/org-at-risk-members-dialog.component.html: 15

Copy link

codecov bot commented Jan 9, 2025

Codecov Report

Attention: Patch coverage is 81.15942% with 13 lines in your changes missing coverage. Please review.

Project coverage is 34.44%. Comparing base (3917f50) to head (fc01259).
Report is 50 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../vault/src/components/carousel/carousel.stories.ts 0.00% 9 Missing ⚠️
...ault/src/components/carousel/carousel.component.ts 94.11% 2 Missing ⚠️
...arousel/carousel-slide/carousel-slide.component.ts 87.50% 0 Missing and 1 partial ⚠️
libs/vault/src/components/carousel/index.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #12791    +/-   ##
========================================
  Coverage   34.44%   34.44%            
========================================
  Files        2974     2990    +16     
  Lines       90667    90828   +161     
  Branches    16989    16996     +7     
========================================
+ Hits        31233    31289    +56     
- Misses      56968    57072   +104     
- Partials     2466     2467     +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sukhleenb
Copy link

sukhleenb commented Jan 9, 2025

This looks great! Something minor, the focus state in the recording differs slightly from what has been defined here. Could we match the Figma UI for consistency? Also is the click target at least 24px?

Copy link
Contributor

@vleague2 vleague2 left a comment

Choose a reason for hiding this comment

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

One thought on a quick look!

* Provide a height value of the tallest slide to prevent this.
* The value should be in `rem`.
*/
@Input() height?: `${number}rem` | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

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

💭 I wonder if you can do this internally in the component? If you have access to all the slides (I haven't fully reviewed to check), you could grab the rendered element height of the tallest one and then set the height to that? (You might have to have all of them rendered but hidden to do that)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

💯 That was one of my ideas in the description. I think I'll have to render them off screen to avoid causing flashes to the user but I'll give it a shot!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nick-livefront
Copy link
Collaborator Author

nick-livefront commented Jan 10, 2025

This looks great! Something minor, the focus state in the recording differs slightly from what has been defined here. Could we match the Figma UI for consistency?

@sukhleenb Thank you for linking those! I didn't see those designs in the ticket.

Also is the click target at least 24px?

Yes!

Screen.Recording.2025-01-10.at.1.43.38.PM.mov

- This avoids consumers having to pass in a height.
- The height of the tallest slide is needed because it will stop the carousel from jumping around as the user scrolls.
@nick-livefront
Copy link
Collaborator Author

@vleague2 @gbubemismith you both pointed out the height Input. I added a decent amount of logic to render each slide, get the tallest height and set the height of the carousel that way. Let me know what you think!

550d86a

});

// Set the min height of the entire carousel based on the largest slide.
this.minHeight = `${(tallestSlideHeightPx + heightOfButtonsPx) / ROOT_PX_FONT_SIZE}rem`;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is fine to leave this in pixels since it is dynamically calculated. I have some concerns about storing the root px font size in this file since it will likely get out of sync if we change the base font size in the css again, so using pixels for this minHeight means we don't need to do that.

Copy link
Collaborator Author

@nick-livefront nick-livefront Jan 16, 2025

Choose a reason for hiding this comment

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

My initial thought was wanting rem to account for users zooming in or out but after testing even pixels works for that. I am surprised but TIL.

fc01259

@vleague2
Copy link
Contributor

Forgot to put in my approval comment, but reminder to approve UI tests and have design approve UI review!

@nick-livefront
Copy link
Collaborator Author

@danielleflinn @sukhleenb When you have a chance, could you review the UI Review?

* Render each slide in a temporary portal outlet to get the height of each slide
* and store the tallest slide height.
*/
private setMinHeightOfCarousel() {
Copy link
Member

Choose a reason for hiding this comment

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

Nice 👍🏼

@nick-livefront nick-livefront merged commit e26670c into main Jan 22, 2025
84 checks passed
@nick-livefront nick-livefront deleted the vault/pm-14422/vault-carousel branch January 22, 2025 14:45
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