Skip to content

[CL-473] Adjust popup page max width and scroll containers #14853

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

vleague2
Copy link
Contributor

@vleague2 vleague2 commented May 20, 2025

🎟️ Tracking

CL-473

📔 Objective

The popup page had strange jumping behavior at its max width breakpoint, and the scrollbar was appearing at that content max width instead of on the righthand side of the window. This PR fixes these issues by:

  • Removing legacy breakpoint css
  • Adding a wrapper as a child of the popup-page nonscrollable region to set the max width
  • Hiding the 1px border on the nonscrollable region because it was bothering me to have it be 1px in height when the region was empty
  • Adjusting the popup-page scrollable container to have the padding appear on the container that has the scrollbar, and setting the max width on the child of that container depending on whether or not a virtual scroll child is present (we want it full width if there's a virtual scroll child so that the virtual scroll child can set its own padding and max width, since it has its own scrollbar that needs to stick to the right side of the page)
  • Adjusting the vault page's virtual scroll implementation to have another wrapper layer with a max width to match the popup-page's scrollable container implementation
  • Add storybook docs and story for virtual scroll implementation example

📸 Screenshots

Before:

Screen.Recording.2025-05-20.at.9.38.16.AM.mov

After:

Screen.Recording.2025-05-20.at.9.35.06.AM.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 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

Copy link
Contributor

github-actions bot commented May 20, 2025

Logo
Checkmarx One – Scan Summary & Detailsc690d593-080b-43c8-aabb-eb0f12087b82

Great job, no security vulnerabilities found in this Pull Request

Copy link

codecov bot commented May 20, 2025

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 36.41%. Comparing base (1c4d851) to head (36a26d5).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../src/platform/popup/layout/popup-layout.stories.ts 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14853      +/-   ##
==========================================
- Coverage   36.41%   36.41%   -0.01%     
==========================================
  Files        3212     3212              
  Lines       93265    93275      +10     
  Branches    16833    16835       +2     
==========================================
  Hits        33967    33967              
- Misses      56831    56841      +10     
  Partials     2467     2467              

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vleague2 vleague2 marked this pull request as ready for review May 21, 2025 15:20
@vleague2 vleague2 requested review from a team as code owners May 21, 2025 15:20
Copy link
Member

@danielleflinn danielleflinn left a comment

Choose a reason for hiding this comment

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

Screen recording looks as expected. Thanks for fixing this one!

Comment on lines +175 to +191
## With Virtual Scroll

If you are using a virtual scrolling container inside of the popup page (aka replacing the default
popup page scrolling container with a virtual scroll container), you'll want to configure the
component in the following ways:

- Use the `disablePadding` input on the `popup-page`
- Add padding and scrollbar to the virtual scrolling element to match the default behavior of the
popup page scroll container, which ensures that the scrollbar is at the far right edge of the
popup
- Add max width to the child of the virtual scroll element, matching the max width breakpoints used
in the `popup-page`

See the code in the example below.

<Canvas of={stories.WithVirtualScrollChild} />

Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, this seems like a non-intentional limitation of the current design of the component. Thoughts?

Comment on lines -1 to -2
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +530 to +544

if (!compact) {
// eslint-disable-next-line
console.error(`#${containerId} [data-testid=popup-layout-scroll-region] not found`);
return;
}

const label = canvasEl.querySelector(`#${containerId} .example-label`);

if (!label) {
// eslint-disable-next-line
console.error(`#${containerId} .example-label not found`);
return;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the goal of this change?

>
<div
class="tw-max-w-screen-sm tw-mx-auto tw-flex-1 tw-flex tw-flex-col tw-w-full"
[ngClass]="{ 'tw-p-3 bit-compact:tw-p-2': !disablePadding }"
class="has-[[cdkvirtualscrollingelement]]:tw-max-w-full tw-max-w-screen-sm tw-mx-auto tw-flex-1 tw-flex tw-flex-col tw-w-full"
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. This seems fragile. Is Tailwind has just direct descendants?
  2. It seems odd that we are asking consumers to manually configure the component base on its supplied descendants in one place disablePadding, but then automatically checking descendants in another.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why does Vault need their own cdkVirtualScrollingElement?

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.

3 participants