google / google/material-design-lite

componentHandler.registerUpgradedCallback fires before the element is assigned a component instance

Open
#4,963 2 comments 0 reactions 0 assignees View on GitHub
Component Handler confirmed v1-bug
Dominant language
HTML
Stars
32.2k
Forks
4.9k
PR merge metrics
No merged PRs in 30d

Description

> What MDL Version are you using? (please be specific, e.g. _major.minor.patch_)

1.2.1

> What browser(s) is this bug affecting (including version)?

All? (Tested on Chrome Version 55.0.2883.75 m)

> What OS (and version) are you using?

Windows 10 x64

> What are the steps to reproduce the bug? Can you create a plunker/codepen/jsfiddle which reproduces it?

http://codepen.io/westy92/pen/NbYoqQ?editors=1010

> What is the expected behavior?

`snackbar.MaterialSnackbar` is defined and `snackbar.MaterialSnackbar.showSnackbar(...)` can be called.
(Similar to http://codepen.io/westy92/pen/gLeqYQ?editors=1010)

> What is the actual behavior?

`snackbar.MaterialSnackbar` is *not* defined and `snackbar.MaterialSnackbar.showSnackbar(...)` crashes.

> Any other information you believe would be useful?

I believe the fix is as simple as swapping this if block with the for block above it: https://github.com/google/material-design-lite/blob/mdl-1.x/src/mdlComponentHandler.js#L249

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.