vaadin / vaadin-context-menu

The responsive Web Component for showing context dependent items for any element on the page. Part of the Vaadin components.
https://vaadin.com/components
Apache License 2.0
26 stars 10 forks source link

WIP position left aligned submenu [skip ci] #264

Closed web-padawan closed 4 years ago

web-padawan commented 4 years ago

Connected to #261

DO NOT MERGE. This PR is a draft.

Changed the demo to have 4 levels of nesting to test it behaves like this:

nested

Need to check if the fix works and add the tests.

Harry-Ph commented 4 years ago

Connected to #261

DO NOT MERGE. This PR is a draft.

Changed the demo to have 4 levels of nesting to test it behaves like this:

nested

Need to check if the fix works and add the tests.

Hi Serhii, It does not work. Menu and submenu is left aligned like this:

Screenshot 2019-12-10 at 10 09 03

I continue investigating how to fix it.

web-padawan commented 4 years ago

@hongduc-phan ok, turns out there are several cases when menu is opened.

  1. parent menu is right aligned, submenu is right aligned - works (if space is enough)
  2. parent menu is left aligned, submenu is left aligned - works with my fix
  3. parent menu is left aligned, submenu is right aligned - does not seem to work with my fix

This is a tricky issue. If you have problems finding a solution, no worries. While you continue to investigate I'll try to take another look myself.

Harry-Ph commented 4 years ago

@hongduc-phan ok, turns out there are several cases when menu is opened.

  1. parent menu is right aligned, submenu is right aligned - works (if space is enough)
  2. parent menu is left aligned, submenu is left aligned - works with my fix
  3. parent menu is left aligned, submenu is right aligned - does not seem to work with my fix

This is a tricky issue. If you have problems finding a solution, no worries. While you continue to investigate I'll try to take another look myself.

The difficulty of left-aligned is to have the width of sub-menu. We can not control the width and it often inside much the parent menu if it is long enough. Yes, I continue to fix it.