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

ComboBox popup behaves badly when ComboBox is placed to right edge #11718

Closed
TatuLund opened this issue Sep 11, 2019 · 1 comment · Fixed by #11755
Closed

ComboBox popup behaves badly when ComboBox is placed to right edge #11718

TatuLund opened this issue Sep 11, 2019 · 1 comment · Fixed by #11755
Assignees
Labels
Milestone

Comments

@TatuLund
Copy link
Contributor

TatuLund commented Sep 11, 2019

Vaadin 8.8.6
Browser: Chrome 76, Edge, probably others too

Steps to replicate

  • Create UI where ComboBox is placed on the right edge of the UI.

  • Add items, which are wider than ComboBox itself.

  • comboBox.setPopupWidth(null) (or 100% or something that is wider than ComboBox)

  • Open the ComboBox

  • Hover mouse to first item on popup (popup will shift slightly to right, pushing UI to the left)

  • Hover mouse back to the text box (you will see that popup extends outside of the screen)

  • Hover mouse back to the first item (popup will shift even more to the right, pushing UI to the left)

Originally reported in Forum (including video)

https://vaadin.com/forum/thread/17826265/combobox-popup-on-far-right-modifies-main-layout

@anasmi anasmi added the BFP label Sep 12, 2019
@anasmi
Copy link
Contributor

anasmi commented Sep 12, 2019

Code to reproduce:

 ComboBox<String> nameComboBox = new ComboBox<>("Long items");
 nameComboBox.setPopupWidth(null);
 nameComboBox.setItems(Arrays.asList("First Very long item to add",
                  "Second very long item to add", "Third very long item to add"));
                
addComponent(nameComboBox);
 Page.getCurrent().getStyles().add(".v-slot.v-slot-positionRight {float:right;}");
 Page.getCurrent().getStyles().add(".removePadding {padding: 0px !important;}");
 getLayout().setMargin(false);
 getLayout().setSpacing(false);
 getLayout().getParent().addStyleName("removePadding");
 getLayout().getParent().removeStyleNames("v-margin-right","v-margin-left");
 nameComboBox.addStyleName("positionRight");

anasmi pushed a commit to anasmi/framework that referenced this issue Sep 12, 2019
1. Created UI test
2. No there is no error, when pop-up is opened and positioned right without padding/margin, but need to verify:
  - Behaviour, when there is no left padding/margin
  - pop-up still moves, when opened by multiple px. Re-positioned, when navigated
@Ansku Ansku self-assigned this Oct 22, 2019
Ansku added a commit to Ansku/framework that referenced this issue Oct 23, 2019
Ansku added a commit to Ansku/framework that referenced this issue Oct 23, 2019
@Ansku Ansku added this to the 8.9.2 milestone Oct 24, 2019
Ansku added a commit to Ansku/framework that referenced this issue Nov 13, 2019
- If an open popup is reset to its default position on every update from
the server before getting adjusted again to the actual expected
position, on heavier applications some of those intermediate positions
might get rendered. If the ComboBox is positioned at the right edge and
the popup contents are longer than the input field (i.e. popup should
open to the left, not right) this might cause flickering.
- Setting the default position is only actually needed when the popup is
opened in order to give it a baseline, otherwise it's better to simply
adjust the position if needed.

Continues on vaadin#11718
Ansku added a commit that referenced this issue Nov 13, 2019
- If an open popup is reset to its default position on every update from
the server before getting adjusted again to the actual expected
position, on heavier applications some of those intermediate positions
might get rendered. If the ComboBox is positioned at the right edge and
the popup contents are longer than the input field (i.e. popup should
open to the left, not right) this might cause flickering.
- Setting the default position is only actually needed when the popup is
opened in order to give it a baseline, otherwise it's better to simply
adjust the position if needed.

Continues on #11718
Ansku added a commit that referenced this issue Nov 13, 2019
- If an open popup is reset to its default position on every update from
the server before getting adjusted again to the actual expected
position, on heavier applications some of those intermediate positions
might get rendered. If the ComboBox is positioned at the right edge and
the popup contents are longer than the input field (i.e. popup should
open to the left, not right) this might cause flickering.
- Setting the default position is only actually needed when the popup is
opened in order to give it a baseline, otherwise it's better to simply
adjust the position if needed.

Continues on #11718
Ansku added a commit that referenced this issue Nov 14, 2019
- If an open popup is reset to its default position on every update from
the server before getting adjusted again to the actual expected
position, on heavier applications some of those intermediate positions
might get rendered. If the ComboBox is positioned at the right edge and
the popup contents are longer than the input field (i.e. popup should
open to the left, not right) this might cause flickering.
- Setting the default position is only actually needed when the popup is
opened in order to give it a baseline, otherwise it's better to simply
adjust the position if needed.

Continues on #11718
Ansku added a commit to Ansku/framework that referenced this issue Dec 17, 2019
Expand ratio and spacing can cause ComboBox to miscalculate its own
position while layouting is still ongoing. Popup should not be
repositioned in such circumstances in order to avoid incorrect
intermediate states.

Continues on vaadin#11718
Ansku added a commit to Ansku/framework that referenced this issue Dec 18, 2019
Expand ratio and spacing can cause ComboBox to miscalculate its own
position while layouting is still ongoing. Popup should not be
repositioned in such circumstances in order to avoid incorrect
intermediate states.

Continues on vaadin#11718
Ansku added a commit that referenced this issue Dec 18, 2019
…t. (#11846)

Expand ratio and spacing can cause ComboBox to miscalculate its own
position while layouting is still ongoing. Popup should not be
repositioned in such circumstances in order to avoid incorrect
intermediate states.

Continues on #11718
Ansku added a commit that referenced this issue Dec 19, 2019
…t. (#11846)

Expand ratio and spacing can cause ComboBox to miscalculate its own
position while layouting is still ongoing. Popup should not be
repositioned in such circumstances in order to avoid incorrect
intermediate states.

Continues on #11718
Ansku added a commit that referenced this issue Dec 19, 2019
…t. (#11846) (#11852)

Expand ratio and spacing can cause ComboBox to miscalculate its own
position while layouting is still ongoing. Popup should not be
repositioned in such circumstances in order to avoid incorrect
intermediate states.

Continues on #11718
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