Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

md-tabs: Cannot read property 'offsetLeft' of undefined #3264

Closed
jo-me opened this issue Jun 15, 2015 · 4 comments
Closed

md-tabs: Cannot read property 'offsetLeft' of undefined #3264

jo-me opened this issue Jun 15, 2015 · 4 comments
Assignees
Milestone

Comments

@jo-me
Copy link

jo-me commented Jun 15, 2015

Hi,
just upgraded to latest Angular Material 0.10.0-rc4 to check whether the bugfixes for my issues regarding md-tabs are having the expected effects. (I'm referring to #3169, #3170 , #2730 )

However, I get a new error when the tabs are created:
'TypeError: Cannot read property 'offsetLeft' of undefined

The error is easily reproducible if the tabs are created asynchronously (e.g. after timeout).
See here: http://plnkr.co/edit/qpAPFBFOPBs6pnaiR1nH?p=preview

It sounds very similar to #2402.
Asynchronous loading of tabs also breaks #3169 again..

Cheers

@glomotion
Copy link

So this particular bug is blocking us upgrading from ~0.6.0 to 0.10.0 as we heavily rely on md-tabs.

Another (ultra simple) example of the bug replicated on codepen: http://codepen.io/glomotion/pen/pJrxYO?editors=101.

I know it's sometimes pretty hard to forecast timelines for stuff like this, but I was just wondering if there is any idea around how long it might take for this bug to be addressed?

@robertmesserle
Copy link
Contributor

I'm adding a fix for this, but in the meantime, it should be easily fixable by adding an ng-if to md-tabs that checks the length. Example:

http://codepen.io/robertmesserle/pen/yNoGJO

@glomotion
Copy link

Oh nice!

I should have thought of that. :)

Thanks Robert, now we can upgrade to 0.10.0! Huzzaaah!

kseamon added a commit to kseamon/material that referenced this issue Jun 18, 2015
Implements a virtual repeater to use instead of ng-repeat for substantially
better performance in components.

review edits

Make tests pass in FF.

fix(tabs): prevents error on empty tab list

Closes angular#3264

fix(button): fixes button styles for components that override their default styles

chore(toast): fix type typo in toast docs (`boolean` > `string`).

fix(utils): update for Angular 1.4.1 compatibility

Fixes angular#3315, Fixes angular#3325.

fix(icons): improve use of material-icons style

Improve logic to auto-add `.material-icons` style to **md-icon**.
> NOTE: will not auto-add if using any class or ng-class attributes; see demoFontIconsWithLigatures

Fixes angular#3333.

update(icon): removed **ddescribe** used for isolated karma tests

update(docs, icon): clarify auto-add of 'material-icons' style.

update(build): use of Angular v1.4.1

update(util): update initOptionalProperties() implementation

Closes angular#3316.

feat(menu): do not propagate event in mdOpenMenu

Do not propagate the event in mdOpenMenu. This way a menu can be nested in elements that also have handlers of the same event type, without triggering any of these events. To enable this functionality, `$event` should be passed as the first argument to `$mdOpenMenu`.

Fixes angular#3296. Closes angular#3332.

update(tests, mocks):  test for stopPropogation

angular-material-mocks captures $timeout.flush() errors.
add menu event propogation test

Switched RawGit for GitCDN

Switch to GitCDN, which lets you get the latest master branch, without losing the CDN and without it's service getting harmed.

Closes angular#3262.

update(README): change docs to reference 0.10.0

Closes angular#3319.
@matt-d-rat
Copy link

I have the same issue, except my use case comes from using transclusion in my custom parent and child directives that leverage md-tabs and md-tab respectively, so effectively I am "dynamically" adding the md-tab directives in a round about way.

I tried using the ng-if approach on the md-tabs in my directive, but then I have other issues because my child directives are dependent on the parent controller and don't get transcluded as a result.

The temp workaround I have for the time being is putting in a "dummy" temporary tab, and removing it in the parent directive after the transclusion has finished. A bit hacky but works for the time being.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants