diff --git a/src/primitives/TabList.js b/src/primitives/TabList.js index 514e0a9..c235ef8 100644 --- a/src/primitives/TabList.js +++ b/src/primitives/TabList.js @@ -27,9 +27,9 @@ class TabList extends Component { } componentDidUpdate() { - if (!this.selectedTabRef) return; - - this.selectedTabRef.focus(); + if (this.selectedTabRef) { + this.selectedTabRef.focus(); + } } setSelectedTabRef(element) { diff --git a/src/wishlist/MovieWishlist.js b/src/wishlist/MovieWishlist.js index 0e6c770..6bc43ff 100644 --- a/src/wishlist/MovieWishlist.js +++ b/src/wishlist/MovieWishlist.js @@ -19,11 +19,24 @@ class MovieWishlist extends Component { movieIdInEdit: null }; + this.addSomeMoviesLink = null; + + this.setAddSomeMoviesLinkRef = this.setAddSomeMoviesLinkRef.bind(this); this.handleShowEditor = this.handleShowEditor.bind(this); this.handleHideEditor = this.handleHideEditor.bind(this); this.handleUpdateMovie = this.handleUpdateMovie.bind(this); } + componentDidMount() { + if (this.addSomeMoviesLink) { + this.addSomeMoviesLink.focus(); + } + } + + setAddSomeMoviesLinkRef(element) { + this.addSomeMoviesLink = element; + } + handleShowEditor(movieId) { this.setState({ showEditor: true, @@ -109,7 +122,9 @@ class MovieWishlist extends Component { // No movies yet in the WishList :