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

No scrollbar in Select component when menu has dividers #6804

Merged
merged 6 commits into from
Jun 20, 2024

Conversation

evansjohnson
Copy link
Contributor

@evansjohnson evansjohnson commented May 15, 2024

Fixes #6780

Checklist

  • Includes tests
  • Update documentation

I don't think these are relevant for this PR

Changes proposed in this pull request:

For a menu divider inside of a select-popover, we already have applied a 5px padding inside the popover. This means to get to full popover width we need to apply the -5px margin to the outer list element, and therefor also undo the -5px margin on the menu divider.

This PR is a variation on #6786, which correctly identified that the -5px margin on the menu divider is responsible for the scrollbar being added, but this PR additionally applies this -5px margin on the list element so that the divider continues to take up the full width.

Reviewers should focus on:

Screenshot

Before
Screenshot 2024-05-15 at 2 20 22 PM

After
Screenshot 2024-05-15 at 2 19 48 PM
*note right and bottom padding outside of list are now also removed. this seems to match what we do in the menu popover

@changelog-app
Copy link

changelog-app bot commented May 15, 2024

Generate changelog in packages/core/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

No scrollbar in Select component when menu has dividers


Generate changelog in packages/select/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

No scrollbar in Select component when menu has dividers


Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

no select scrollbar with dividers

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@svc-palantir-github
Copy link

alpha order

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@chaejunlee
Copy link

I think going over the <Menu /> is necessary. Can you post the screenshot of it?

@evansjohnson
Copy link
Contributor Author

There's no changes to the menu in this PR, except when inside a select popover

I checked for good measure and in the generated docs preview you can see the styling menu is unaffected:
Screenshot 2024-05-16 at 5 28 33 PM

Note in #6786 since the -5px margin is removed there is a slight visual regression in the screenshot where the border no longer goes to the edge of the menu, which seems to be what the intent of that style is.

@gluxon gluxon self-assigned this May 29, 2024
Copy link
Contributor

@gluxon gluxon left a comment

Choose a reason for hiding this comment

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

Menu Items Flush

Is it intended that the menu items themselves are flush with the border of the popover after these changes? I see from your description that we wanted to make the horizontal dividers flush, which I agree with.

Screenshot 2024-05-30 at 1 15 34 PM

Here's the before picture again for reference. I think the intended visual design was to have a bit of spacing around them menu item since the light blue hover background has a slight border radius. That border radius doesn't look as great if the background is how flush with the border.

Screenshot 2024-05-30 at 1 15 23 PM

Suggestion

I'm wondering if we should tweak @mixin menu-divider()'s implementation to instead be a ::before pseudo-element that is "out of flow".

The negative margin would then only be on the pseudo-element driving the horizontal border. Since the pseudo-element is "out of flow", we would eliminate unintended CSS layout calculations (like this one) entirely in the future.

@evansjohnson
Copy link
Contributor Author

evansjohnson commented Jun 18, 2024

Thanks for the close look and good catch @gluxon!

I wrapped up this approach since it was easy to add back the margin one more time for the items, but given how much back and forth this is I may try the psuedo element approach quickly as well.

As a nice to have - it looks like there was a small stying weirdness where there is empty space padding to the left but not right of the selection. With fixing the scrollbar overflow this also sizes the menu items correctly to have padding on both sides.

develop

Screenshot 2024-06-18 at 8 55 35 AM Screenshot 2024-06-18 at 8 55 29 AM

this PR

Screenshot 2024-06-18 at 8 56 00 AM Screenshot 2024-06-18 at 8 56 07 AM

with scrollbars showing only when scrolling still looks good
Screenshot 2024-06-18 at 9 04 10 AM
Screenshot 2024-06-18 at 9 04 01 AM

@svc-palantir-github
Copy link

add side padding around selection highlight

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

}
}

.#{$ns}-menu-item {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder if there may be other classes we need to target with adding back the margin we take away above...

From what I could tell from the docs it seems like only elements that get this bp-menu-item class are intended to go into a menu, but I suppose it may be allowed by the API to develop custom menu items that may now shift around with this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ahh, I think this was a good note... pushing to make the divider and menu items not be a special case got me to bring back the padding on the actual menu, which allows the divider to keep it's normal negative margin

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@evansjohnson evansjohnson requested a review from gluxon June 18, 2024 13:36
@svc-palantir-github
Copy link

better approach?

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

packages/select/src/components/select/_select.scss Outdated Show resolved Hide resolved
Comment on lines 20 to 21
// offset the padding added by the select componenent so menu can remain full width with padding on either side
// for menu items
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is it worth a comment that this is specifically to allow dividers to be flush with the popover's edge?

@gluxon
Copy link
Contributor

gluxon commented Jun 19, 2024

As a nice to have - it looks like there was a small stying weirdness where there is empty space padding to the left but not right of the selection. With fixing the scrollbar overflow this also sizes the menu items correctly to have padding on both sides.

Very nice! 😁

gluxon
gluxon previously approved these changes Jun 19, 2024
Co-authored-by: Brandon Cheng <gluxon@users.noreply.github.com>
@policy-bot policy-bot bot dismissed gluxon’s stale review June 19, 2024 03:58

Invalidated by push of 1607746

@svc-palantir-github
Copy link

Update packages/select/src/components/select/_select.scss

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@evansjohnson evansjohnson merged commit 0d36ba1 into develop Jun 20, 2024
12 of 14 checks passed
@evansjohnson evansjohnson deleted the evanj/no-scrollbar-in-select branch June 20, 2024 13:07
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.

Select has a horizontal scrollbar
4 participants