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

Wrong Popup direction on ComboBox #11894

Closed
BernhardWa opened this issue Feb 19, 2020 · 3 comments · Fixed by #11902
Closed

Wrong Popup direction on ComboBox #11894

BernhardWa opened this issue Feb 19, 2020 · 3 comments · Fixed by #11902
Labels
Milestone

Comments

@BernhardWa
Copy link

The popup of a Combobox always open below even if there is actually no space. The Popup shown then is too small and not sowing all items as there is just not enough space (See attachment). This occurs with the Vaadin Versions 8.10.0 and 8.9.4
Combobox

@BernhardWa BernhardWa changed the title Wrong Popu direction on ComboBox Wrong Popup direction on ComboBox Feb 19, 2020
@TatuLund
Copy link
Contributor

I tried to reproduce the problem with demo.vaadin.com/sampler by reducing the Window size so that ComboBox popup does not fit below, and it worked correctly by opening it on top of field. So I cannot reproduce this.

@BernhardWa
Copy link
Author

Ok, May be I need to investigate this further but I can reproducte it and went back to the version 8.9.3 where it works fine for me. On the versions 8.10.0 and 8.9.4 the ComboBox always opens below, with 8.9.3 it opens on top. I check if i can find out more about this behaviour.

@BernhardWa
Copy link
Author

I can reproducte it when I put the ComboBox in a HorizontalLayout. Then the Popup always opens blow the ComboBox instead of above.

With HorizontalLayout (Popup opens blow which is wrong)

WithHorizontalLayout

Code:

public class InfoDialog extends Window {

  public InfoDialog() {
    setResizable(false);
    setCaption("Info");
    setWidth(200, Unit.PIXELS);

    ComboBox<Integer> comboBox = new ComboBox<>();
    comboBox.setItems(Arrays.asList(50, 100, 200, 500, 1000));
    comboBox.setValue(50);
    comboBox.setWidth(120, Unit.PIXELS);

    HorizontalLayout horizontalLayout = new HorizontalLayout();
    horizontalLayout.addComponent(comboBox);
		
    setContent(horizontalLayout);
  }
}

Without HorizontalLayout: (Looks correct)

WithoutHorizontalLayout

Code:

public class InfoDialog extends Window {
  private static final long serialVersionUID = 1L;
	
  public InfoDialog() {
    setResizable(false);
    setCaption("Info");
    setWidth(200, Unit.PIXELS);
		
    ComboBox<Integer> comboBox = new ComboBox<>();
    comboBox.setItems(Arrays.asList(50, 100, 200, 500, 1000));
    comboBox.setValue(50);
    comboBox.setWidth(120, Unit.PIXELS);

//  HorizontalLayout horizontalLayout = new HorizontalLayout();
//  horizontalLayout.addComponent(comboBox);
		
    setContent(comboBox);
  }
}

TatuLund added a commit that referenced this issue Feb 27, 2020
setPopupPosition(left, top); needs to be called in order to top position to be set

Fixes #11894
@TatuLund TatuLund added the BFP label Feb 27, 2020
OlliTietavainenVaadin pushed a commit that referenced this issue Mar 2, 2020
* Adding missing setPopupPosition(left, top);

setPopupPosition(left, top); needs to be called in order to top position to be set

Fixes #11894
ZheSun88 pushed a commit that referenced this issue Mar 2, 2020
* Adding missing setPopupPosition(left, top);

setPopupPosition(left, top); needs to be called in order to top position to be set

Fixes #11894
TatuLund added a commit that referenced this issue Mar 2, 2020
* Removing code causing the  trouble (#11898)

* Removing code causing the  trouble

Removing code that was apparently not needed in previous fix and caused regression 

Fixes: #11895

* Added feature to test UI

* Added test case

* Adding missing import

* Fixing test UI

* Enable DateField

* Rewrote debouncing of onResize (#11899)

* Rewrote debouncing of onResize 

Fixes #11892

* Fixing typo in variable name

* Adding missing setPopupPosition(left, top); (#11902)

* Adding missing setPopupPosition(left, top);

setPopupPosition(left, top); needs to be called in order to top position to be set

Fixes #11894

Co-authored-by: Tatu Lund <tatu@vaadin.com>
@ZheSun88 ZheSun88 added this to the 8.10.2 milestone Mar 3, 2020
Ansku added a commit to Ansku/framework that referenced this issue Mar 4, 2020
- Updated a comment and renamed a private method for better clarity.
- Blocked unnecessary position updates.
- Added a test for vaadin#11866 / vaadin#11894.
Ansku added a commit to Ansku/framework that referenced this issue Mar 5, 2020
- Updated a comment and renamed a private method for better clarity.
- Blocked unnecessary position updates.
- Added a test for vaadin#11866 / vaadin#11894.
OlliTietavainenVaadin pushed a commit that referenced this issue Mar 6, 2020
* Further tweaks to ComboBox popup positioning.

- Updated a comment and renamed a private method for better clarity.
- Blocked unnecessary position updates.
- Added a test for #11866 / #11894.
Ansku added a commit that referenced this issue Mar 23, 2020
* Further tweaks to ComboBox popup positioning.

- Updated a comment and renamed a private method for better clarity.
- Blocked unnecessary position updates.
- Added a test for #11866 / #11894.
Ansku added a commit that referenced this issue Mar 24, 2020
* Further tweaks to ComboBox popup positioning.

- Updated a comment and renamed a private method for better clarity.
- Blocked unnecessary position updates.
- Added a test for #11866 / #11894.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants