Adds method that calculates space underneath KSelect before displayin… #402
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…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
After
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 theoffsetHeight
of thescrollableAncestor
are used to determine if there is enough space to display the dropdown menu underneath the button. If there is not, thebottom
css property of the dropdown menu is set to thebuttonHeight
.Does this introduce any tech-debt items?
Testing checklist
changelog
Reviewer guidance