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

Add elastic position strategy to igxOverlay #2697

Closed
lalo-mx opened this issue Oct 4, 2018 · 7 comments
Closed

Add elastic position strategy to igxOverlay #2697

lalo-mx opened this issue Oct 4, 2018 · 7 comments
Assignees
Labels
dropdown 🧰 feature-request version: 7.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@lalo-mx
Copy link

lalo-mx commented Oct 4, 2018

Description

Add elastic position strategy to igxOverlay.

  • igniteui-angular version: 6.2.0-beta.3
  • browser: Chrome 69.0.3497.100

Steps to reproduce

  1. Open sample Example Dropdwon bottom page
  2. Click on Options button

Result

Scroll does not appears when exists many options and the dropdown is not fully visible.

Expected result

If the dropdown is the last element of the page then it adjust automatically in order to be shown.
Also that if the content of the overlay is not visible on the screen the container will have a scroll.

Attachments

dropdown-scroll.zip
image

@wnvko
Copy link
Contributor

wnvko commented Oct 5, 2018

igxDropDown has no default height. If you do not set height for your igxDropDown it will render without scrollbar. To fix this set height of the drop down, either in markup or in code behind like this:

<igx-drop-down #dropdown1 height='400px'>
    <igx-drop-down-item *ngFor="let item of items">
        {{ item.field }}
    </igx-drop-down-item>
</igx-drop-down>

this.igxDropDown.height = '400px';

If you set this in code behind nice place to place it is in OnInit event handler.

@wnvko wnvko closed this as completed Oct 5, 2018
@lalo-mx
Copy link
Author

lalo-mx commented Oct 5, 2018

Yes, that solution works but it would not work very well for mobile. I tried setting the height to 100% and it did not works. Should the dropdown be responsive?

@wnvko
Copy link
Contributor

wnvko commented Oct 5, 2018

If you set the height to 100% this should not work too. IgxDropDown uses IgxOverlayService to show itself. What overlay does it next. It takes the drop down items container. Measures its size. Creates host element. Positions the host element and puts the drop down items container inside it. When you set 100% height the container of drop down items returns the total height of all items - this is the same as to leave the drop down without height. If you want to go with 100% you may put drop down items in a container with predefined height like this:

<igx-drop-down #dropdown1>
  <div style="height: 200px">
      <igx-drop-down-item *ngFor="let item of items">
          {{ item.field }}
    </igx-drop-down-item>
  </div>

However this is the same as to set the drop down height to 200 px.
Why you think drop down is not responsive?

@lalo-mx
Copy link
Author

lalo-mx commented Oct 5, 2018

One responsiveness that i was expecting of the dropdown is that if the field is the last element of the page then it does not show as expected. For example Example Dropdwon bottom page

Also that if the content of the overlay is not visible on the screen the container will adjust automatically and/or have a scroll. I will use your suggested workaround.

@wnvko
Copy link
Contributor

wnvko commented Oct 16, 2018

We have investigated this additionally. Right now igxOverlay service is able to position content in three ways:

  • global - show the content related to the screen;
  • connected - shows the content related to an element - this is what igxDropDown uses;
  • auto - show the content related to an element, and flips it if it does not fit in the screen;

What you need is something like elastic position strategy - this should be like connected, but should resize element if it does not fit on the screen. This is something we do not have right now.

Can you please rename your issue to something like 'Add elastic position strategy to igxOverlay'?
I am reopening now this issue and will label it as feature request.

@wnvko wnvko reopened this Oct 16, 2018
@lalo-mx lalo-mx changed the title Scroll not working in dropdown Add elastic position strategy to igxOverlay Oct 16, 2018
@lalo-mx
Copy link
Author

lalo-mx commented Oct 16, 2018

We have investigated this additionally. Right now igxOverlay service is able to position content in three ways:

  • global - show the content related to the screen;
  • connected - shows the content related to an element - this is what igxDropDown uses;
  • auto - show the content related to an element, and flips it if it does not fit in the screen;

What you need is something like elastic position strategy - this should be like connected, but should resize element if it does not fit on the screen. This is something we do not have right now.

Can you please rename your issue to something like 'Add elastic position strategy to igxOverlay'?
I am reopening now this issue and will label it as feature request.

Done.

@wnvko
Copy link
Contributor

wnvko commented Dec 3, 2018

We are starting to work on this now. What we plan to implement is a new position strategy in IgxOverlayService. This new strategy, elastic positioning, should be able according to provided min height and min width to resize the shown component, so it can fit as much as possible on the screen. This new strategy should extend connected position strategy. The new positioning will be applied only to components which goes out of the view. As a result of applying this new strategy shown component may draw horizontal and/or vertical scroll bar(s).

bazal4o added a commit that referenced this issue Jan 2, 2019
…oning-strategy

Elastic positioning strategy, #2697
@wnvko wnvko added ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged. and removed 🛠️ status: in-development Issues and PRs with active development on them labels Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dropdown 🧰 feature-request version: 7.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

No branches or pull requests

5 participants