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

(fix) Fix ng-select dropdown position #108

Merged
merged 1 commit into from
Dec 18, 2023
Merged

Conversation

denniskigen
Copy link
Member

@denniskigen denniskigen commented Dec 18, 2023

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

I've fixed an issue with the placement of the dropdown element when using ng-select elements in the form engine. More specifically, the ng-select element gets used when the chosen rendering type for a field is multiCheckbox. In the ng-select configuration, you can choose to provide a string value to the appendTo input. appendTo allows you to append the dropdown to the body of your document or any other element using a CSS selector.

Presently, the dropdown's appendTo input is set to form, which means the dropdown gets appended to the form element. This results in the dropdown getting rendered in the wrong position. In this PR, I've amended the appendTo input's value to point to the id of the ng-select element that renders the dropdown.

Appending the dropdown to the form tag was originally intended to fix an issue where the dropdown would get cut off if the field occurred at the end of the page. This should no longer be an issue because the default value for the element's dropdownPosition input is auto, which means that the browser will know whether to render the dropdown above or below the field based on its positioning.

Screenshots

Before (note how the dropdown gets rendered outside of the form-renderer element)

improper-dropdown-position.mp4

After

ng-select-dropdown-fix.mp4

Related Issue

https://issues.openmrs.org/browse/O3-2589

Other

@elimm's PR
@ng-select/ng-select README

@ibacher ibacher self-assigned this Dec 18, 2023
@ibacher
Copy link
Member

ibacher commented Dec 18, 2023

Thanks!

@ibacher ibacher merged commit 6bae35c into main Dec 18, 2023
3 checks passed
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.

2 participants