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

fix(menus): Fix menu positioning/animation #6588

Merged
merged 1 commit into from
Mar 5, 2018

Conversation

caseyjhol
Copy link
Contributor

@caseyjhol caseyjhol commented Mar 3, 2018

Current behavior: https://plnkr.co/edit/Sr45hW2zhXcbPxvzEBTB?p=preview
New behavior: https://plnkr.co/edit/mSNHjvbSVCRklVrawk6m?p=preview

Since v3.0.0-rc.21, the column/grid menu animation slides down from
above the grid, but it is visible the entire time. This causes the
animation to appear clunky. This has been resolved by setting overflow: hidden on the menu.

Fixes #3436, #3921, #3978.

Showing/hiding the menu can seem slow. The menu animation has been sped
up as well, and when it is hidden, the animation is now twice as fast.

Previously, to calculate the menu position, the width of the menu needed
to be calculated, which meant calling repositionMenu twice - once when
first opening the menu, and again after the menu is visible to allow the
width of the menu to be determined. This also meant there was always a
"shift" when the menu was first opened (as a default width of 170px was
used until the actual width of the menu could be determined. This
implements the CSS trick right: 100% so the width is not needed when
determining the menu's position, meaning the menu can be opened much
more smoothly and without needing to call repositionMenu twice.

Fixes #6587.

lastMenuWidth has been removed as well, as it is no longer needed.

Looking forward to hearing your feedback.

Since v3.0.0-rc.21, the column/grid menu animation slides down from
above the grid, but it is visible the entire time. This causes the
animation to appear clunky. This has been resolved by setting `overflow:
hidden` on the menu.

Fixes angular-ui#3436, angular-ui#3921, angular-ui#3978.

Showing/hiding the menu can seem slow. The menu animation has been sped
up as well, and when it is hidden, the animation is now twice as fast.

Previously, to calculate the menu position, the width of the menu needed
to be calculated, which meant calling `repositionMenu` twice - once when
first opening the menu, and again after the menu is visible to allow the
width of the menu to be determined. This also meant there was always a
"shift" when the menu was first opened (as a default width of 170px was
used until the actual width of the menu could be determined. This
implements the CSS trick `right: 100%` so the width is not needed when
determining the menu's position, meaning the menu can be opened much
more smoothly and without needing to call `repositionMenu` twice.

Fixes angular-ui#6587.

remove lastMenuWidth from tests

no message
@mportuga mportuga merged commit 25dbd2e into angular-ui:master Mar 5, 2018
@caseyjhol
Copy link
Contributor Author

@mportuga Thanks for merging this! I just realized, though, that I got the animation classes mixed up (it's 0.04s to hide and 0.02s to show - I meant it to be the opposite). Obviously not a huge difference maker, but let me know if you want me to submit another PR.

caseyjhol added a commit to snapappointments/ui-grid that referenced this pull request Mar 8, 2018
Menu width calculation was removed in angular-ui#6588. Menu width needs to be
calculated in order to properly position the menu (if there is not
enough room to the left of the column). repositionMenu is now always
called in the 'menu-shown' event listener to ensure the width can be
properly calculated. The style attribute is removed from $elm in the
'menu-hidden' event listener to prevent the menu from appearing to slide
from the left or right when opening another column menu while one is
already open.

Menu animation speed was changed in angular-ui#6588 to have different add/remove
speeds. 0.04s has been chosen as a happy medium, and the $timeout
duration has been changed to reflect the new transition duration (to
reduce delay when hiding the menu).

`position: relative` has been removed from .ui-grid-header-cell-row to
ensure consistent calculation of offsetParent across browsers.

Fixes angular-ui#5396, angular-ui#5990, angular-ui#6085.
caseyjhol added a commit to snapappointments/ui-grid that referenced this pull request Mar 8, 2018
Menu width calculation was removed in angular-ui#6588. Menu width needs to be
calculated in order to properly position the menu (if there is not
enough room to the left of the column). repositionMenu is now always
called in the 'menu-shown' event listener to ensure the width can be
properly calculated. The style attribute is removed from $elm in the
'menu-hidden' event listener to prevent the menu from appearing to slide
from the left or right when opening another column menu while one is
already open.

Menu animation speed was changed in angular-ui#6588 to have different add/remove
speeds. 0.04s has been chosen as a happy medium, and the $timeout
duration has been changed to reflect the new transition duration (to
reduce delay when hiding the menu).

`position: relative` has been removed from .ui-grid-header-cell-row to
ensure consistent calculation of offsetParent across browsers.

Fixes angular-ui#5396, angular-ui#5990, angular-ui#6085.
mportuga pushed a commit that referenced this pull request Mar 11, 2018
Menu width calculation was removed in #6588. Menu width needs to be
calculated in order to properly position the menu (if there is not
enough room to the left of the column). repositionMenu is now always
called in the 'menu-shown' event listener to ensure the width can be
properly calculated. The style attribute is removed from $elm in the
'menu-hidden' event listener to prevent the menu from appearing to slide
from the left or right when opening another column menu while one is
already open.

Menu animation speed was changed in #6588 to have different add/remove
speeds. 0.04s has been chosen as a happy medium, and the $timeout
duration has been changed to reflect the new transition duration (to
reduce delay when hiding the menu).

`position: relative` has been removed from .ui-grid-header-cell-row to
ensure consistent calculation of offsetParent across browsers.

Fixes #5396, #5990, #6085.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants