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

Position of the overflow menu in Tabs to be right aligned with the trigger button #4617

Open
7 of 11 tasks
akawanishi opened this issue Jan 25, 2025 · 4 comments
Open
7 of 11 tasks
Assignees
Labels

Comments

@akawanishi
Copy link

Latest version

  • I have tested the latest version

Description

Can we switch the position of the overflow menu in Tabs to be right aligned with the trigger button, so that the menu does not overflow right in small screens.

Steps to reproduce

Use TabsNext overflow version and

open overflow menu.

Expected behavior

Right side of overflow menu should align with right side of the trigger button.

Package name(s)

Lab (@salt-ds/lab)

Package version(s)

No response

Browser

  • Chrome
  • Safari
  • Firefox
  • Microsoft Edge

Operating system

  • macOS
  • Windows
  • Linux
  • iOS
  • Android

Are you a JPMorgan Chase & Co. employee?

  • I am an employee of JPMorgan Chase & Co.
@akawanishi akawanishi added the status: awaiting triage Automatically added to new issues. Should be removed once they have been triaged. label Jan 25, 2025
@mark-tate
Copy link
Contributor

mark-tate commented Jan 27, 2025

Can you add a screenshot (or email us)

@mark-tate mark-tate added the status: needs more info This doesn't seem right label Jan 27, 2025
@mark-tate
Copy link
Contributor

mark-tate commented Jan 27, 2025

This requires us to modify the Dropdown, currently placement is hardcoded.
If we could replace this with middleware then it could handle things automatically, based on available space.

in Dropdown.tsx

    useFloatingUI({
      open: openState && !readOnly && Children.count(children) > 0,
      onOpenChange: handleOpenChange,
      placement: "bottom-end",
      middleware: [
        offset(1),
        size({
          apply({ rects, elements, availableHeight }) {
            Object.assign(elements.floating.style, {
              minWidth: `${rects.reference.width}px`,
              maxHeight: `max(calc((var(--salt-size-base) + var(--salt-spacing-100)) * 5), calc(${availableHeight}px - var(--salt-spacing-100)))`,
            });
          },
        }),
        flip({ fallbackStrategy: "initialPlacement" }),
      ],
    });

Sometimes, placement cannot be honoured (due to space) which is where the middleware approach will works in all situations.

@mark-tate mark-tate added groomed and removed status: needs more info This doesn't seem right status: awaiting triage Automatically added to new issues. Should be removed once they have been triaged. labels Jan 27, 2025
@mark-tate
Copy link
Contributor

Oregano Goal:
will be looked at as part of #4644, will feedback to team short-term options

@mark-tate
Copy link
Contributor

blocked pending 4644

@mark-tate mark-tate moved this from Green to On hold in Salt - Components, Patterns and Theming Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

3 participants