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

[SelectField] SelectFields totally broken since 1.7.0 #801

Closed
strblr opened this issue Sep 23, 2018 · 3 comments
Closed

[SelectField] SelectFields totally broken since 1.7.0 #801

strblr opened this issue Sep 23, 2018 · 3 comments
Labels
Milestone

Comments

@strblr
Copy link

strblr commented Sep 23, 2018

Hey,

Since I updated from react-md@1.3.5 to react-md@1.7.0, SelectFields don't work at all.
The app crashes when clicking to expand the item list :

InkContainer.js:89 Uncaught TypeError: Cannot read property 'classList' of undefined
    at InkContainer._this._getKeyboardContainer (InkContainer.js:89)
    at InkContainer._this.focus (InkContainer.js:52)
    at InkedComponent._this.focus (injectInk.js:64)
    at ListItem.focus (ListItem.js:716)
    at _setListItem (SelectField.js:855)
    at commitAttachRef (react-dom.development.js:14804)
    at commitAllLifeCycles (react-dom.development.js:15910)
    [...]

The above error occurred in the <ListItem> component:
    in ListItem (created by SelectField)
    in ul (created by List)
    in List (created by Layover)
    in CSSTransitionGroupChild (created by TransitionGroup)
    in div (created by TransitionGroup)
    in TransitionGroup (created by CSSTransitionGroup)
    in CSSTransitionGroup (created by Layover)
    in Layover (created by Menu)
    in Menu (created by SelectField)
    [...]

My current workaround is to switch back to 1.3.5 (EDIT: 1.5.1 works too, EDIT 2: 1.6.2 is broken like 1.7.0)
After a few tests, I saw that this function in InkContainer.js is never called :

_setContainers = (group) => {
    if (group !== null) {
      // temp workaround for preact
      // https://github.com/mlaursen/react-md/issues/788#issuecomment-419248903
      this.timeout = setTimeout(() => {
        this.timeout = undefined;
        this._inkContainer = findDOMNode(group);
        this._container = this._inkContainer.parentElement;

        if (this._container) {
          this._initOrRemoveEvents(this.props);
        }
      });
    }
  };

Therefore, this._container is undefined here :

_getKeyboardContainer = () => {
    if (this._container.classList.contains('md-text-field-container')) {
      return this._container.querySelector('.md-text-field');
    }

    return this._container;
  };

Version

  • React - latest
  • React-MD - latest
  • Browser - Tested on Firefox & Chrome
@mlaursen mlaursen added the bug label Sep 24, 2018
@mlaursen mlaursen added this to the v1.7.1 milestone Sep 24, 2018
@mlaursen
Copy link
Owner

Looks like I didn't test the preact workaround enough. Sorry.

Since it looks like I would have to do a few more workarounds to get preact working, so I think I'll revert that workaround and re-open #788 to find a better solution.

@mlaursen
Copy link
Owner

1.7.1 should now be released with the Preact workaround removed (and SelectFields working again)

@strblr
Copy link
Author

strblr commented Sep 24, 2018

Thanks for your quick reply. It works fine now !

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

No branches or pull requests

2 participants