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

Adds method that calculates space underneath KSelect before displayin… #402

Conversation

LianaHarris360
Copy link
Member

@LianaHarris360 LianaHarris360 commented Dec 16, 2022

…g dropdown

Description

When there is not enough space below the button to display the menu, the dropdown is partially hidden. This pr updates the KDS UiSelect component to calculate the space underneath the button to determine whether the dropdown menu will display above or below the button.

Issue addressed

Addresses #7752

Before/after screenshots

Before
DropdownMenuBefore

After
DropdownAfter

Steps to test

Please see the corresponding Kolibri PR to test in Kolibri: learningequality/kolibri#9927

(optional) Implementation notes

At a high level, how did you implement this?

On mount, the element's nearest scrollable ancestor is found. When the button is clicked, the position, buttonHeight, maxDropdownheight, and the offsetHeight of the scrollableAncestor are used to determine if there is enough space to display the dropdown menu underneath the button. If there is not, the bottom css property of the dropdown menu is set to the buttonHeight.

Does this introduce any tech-debt items?

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical and brittle code paths are covered by unit tests
  • The change has been added to the changelog

Reviewer guidance

  • Is the code clean and well-commented?
  • Are all UI components LTR and RTL compliant (if applicable)?

@LianaHarris360 LianaHarris360 marked this pull request as ready for review December 20, 2022 15:07
Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

Testing it on the docs demo site looks good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants