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

Programmatically calling show() on a hidden submenu puts it in a buggy state #48

Closed
2 of 8 tasks
theefer opened this issue Apr 5, 2016 · 0 comments
Closed
2 of 8 tasks

Comments

@theefer
Copy link
Contributor

theefer commented Apr 5, 2016

Description

Programmatically expanding (show()) a hidden submenu puts it in a buggy state, where opened is true but the CSS height is 0px.

This is due to a bug in the animation code, and therefore only manifests if the submenu has animations turned on (which is the default).

Live Demo

http://jsbin.com/rutakeciri/edit?html,output

Steps to reproduce

  1. Click on the button (calls show() on the closed iron-collapse nested under a closed top-level iron-collapse).
  2. Click on the top-level iron-collapse.

Expected outcome

The top-level iron-collapse opens and reveals an open nested iron-collapse.

Actual outcome

The top-level iron-collapse opens and reveals an apparently closed nested iron-collapse. (In fact its opened is true but its height is 0.

Clicking on the nested iron-collapse seemingly does nothing (in fact it sets opened to false).

Clicking it again reveals it as expected.

This is due to the way the animation code tries to calculate the target height by setting the desired style and calling getBoundingClientRect. Unfortunately when the element is nested under a hidden parent menu (display: none), gBCR returns 0 as height.

Browsers Affected

  • Chrome
  • Firefox
  • Safari 9
  • Safari 8
  • Safari 7
  • Edge
  • IE 11
  • IE 10

See #49 for a fix.

Note that I've encountered this issue when using paper-menu (which uses iron-collapse internally).

valdrinkoshi pushed a commit that referenced this issue Apr 6, 2016
* Skip animation if not in render tree (else causes broken state)

* Added test for nested components

* Remove nested open test, add test checking visible size

* Add test for nested horizontal collapse

* Rename to isDisplayed and document
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants