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

Autocomplete: Add position prop #2846

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ElishaSamPeterPrabhu
Copy link
Collaborator

@ElishaSamPeterPrabhu ElishaSamPeterPrabhu commented Sep 11, 2024

Description

  • Added position prop for the options container
  • Used popper library for the options container's position

References
Fixes #2801

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Copy link

netlify bot commented Sep 11, 2024

Deploy Preview for moduswebcomponents failed. Why did it fail? →

Name Link
🔨 Latest commit 5b9d336
🔍 Latest deploy log https://app.netlify.com/sites/moduswebcomponents/deploys/66ebcbd1962a1f00081a95c2

Copy link
Collaborator

@prashanth-offcl prashanth-offcl left a comment

Choose a reason for hiding this comment

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

@ElishaSamPeterPrabhu Once I select an option from the bottom of the list, I'm not able to change it.

User.Inputs._.Autocomplete.-.Default.Storybook.-.Google.Chrome.2024-09-12.00-17-54.mp4

@prashanth-offcl prashanth-offcl marked this pull request as draft September 11, 2024 18:49
@ElishaSamPeterPrabhu
Copy link
Collaborator Author

@ElishaSamPeterPrabhu Once I select an option from the bottom of the list, I'm not able to change it.

User.Inputs._.Autocomplete.-.Default.Storybook.-.Google.Chrome.2024-09-12.00-17-54.mp4

Added animation change as fix

@ElishaSamPeterPrabhu ElishaSamPeterPrabhu force-pushed the 2801-autocomplete-add-position-property-to-control-component-placement-relative-to-the-wrapped-item branch from 8604b9d to d6ba058 Compare September 12, 2024 11:12
@ElishaSamPeterPrabhu ElishaSamPeterPrabhu marked this pull request as ready for review September 12, 2024 11:12

initializePopper(): void {
const optionsContainer = this.el.shadowRoot.querySelector(`.options-container`) as HTMLElement;
const referenceElement = this.el as HTMLElement;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we use the chips-container as reference element? Otherwise the dropdown will be positioned based on the entire container height.


this.popperInstance = createPopper(referenceElement, optionsContainer, {
placement: 'bottom-start',
strategy: this.position === 'auto' ? 'fixed' : 'absolute',
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you add a comment about why we use fixed strategy for auto position

Copy link
Collaborator

@prashanth-offcl prashanth-offcl Sep 13, 2024

Choose a reason for hiding this comment

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

Also if I set position to auto, options container width is not restricted to the input width.
image

…onent-placement-relative-to-the-wrapped-item' of https://github.com/trimble-oss/modus-web-components into 2801-autocomplete-add-position-property-to-control-component-placement-relative-to-the-wrapped-item
@prashanth-offcl prashanth-offcl marked this pull request as draft September 13, 2024 11:08
@ElishaSamPeterPrabhu ElishaSamPeterPrabhu marked this pull request as ready for review September 16, 2024 05:23
@prashanth-offcl prashanth-offcl marked this pull request as draft September 30, 2024 09:50
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.

Autocomplete: Add "position" property to control component placement relative to the element
2 participants