remove the need for .firstChild

This commit is contained in:
KDSBrowne 2017-11-28 12:10:12 -08:00
parent 54d82d456c
commit a599bcd7c7
3 changed files with 9 additions and 7 deletions

View File

@ -71,7 +71,7 @@ class UserContent extends Component {
rovingIndex(event, list, items, numberOfItems) {
const active = document.activeElement;
const changedItems = items.firstChild;
const changedItems = items;
if (event.keyCode === KEY_CODES.TAB) {
if (this.focusedItemIndex !== -1) {

View File

@ -3,6 +3,7 @@ import { TransitionGroup, CSSTransition } from 'react-transition-group';
import PropTypes from 'prop-types';
import { defineMessages } from 'react-intl';
import cx from 'classnames';
import ReactDOM from 'react-dom';
import styles from './styles';
import ChatListItem from './../../chat-list-item/component';
@ -90,7 +91,7 @@ class UserMessages extends Component {
event => this.props.rovingIndex(
event,
this._msgsList,
this._msgItems,
ReactDOM.findDOMNode(this._msgItems),
this.props.openChats.length,
),
);
@ -120,8 +121,8 @@ class UserMessages extends Component {
className={styles.scrollableList}
ref={(ref) => { this._msgsList = ref; }}
>
<div ref={(ref) => { this._msgItems = ref; }} className={styles.list}>
<TransitionGroup>
<div className={styles.list}>
<TransitionGroup ref={(ref) => { this._msgItems = ref; }} >
{openChats.map(chat => (
<CSSTransition
classNames={listTransition}

View File

@ -2,6 +2,7 @@ import React, { Component } from 'react';
import { TransitionGroup, CSSTransition } from 'react-transition-group';
import PropTypes from 'prop-types';
import { defineMessages } from 'react-intl';
import ReactDOM from 'react-dom';
import cx from 'classnames';
import styles from '/imports/ui/components/user-list/user-list-content/styles';
import UserListItem from './user-list-item/component';
@ -108,7 +109,7 @@ class UserParticipants extends Component {
event => this.props.rovingIndex(
event,
this.refScrollContainer,
this.refScrollItems,
ReactDOM.findDOMNode(this.refScrollItems),
this.props.users.length,
),
);
@ -196,8 +197,8 @@ class UserParticipants extends Component {
tabIndex={0}
ref={(ref) => { this.refScrollContainer = ref; }}
>
<div ref={(ref) => { this.refScrollItems = ref; }} className={styles.list}>
<TransitionGroup>
<div className={styles.list}>
<TransitionGroup ref={(ref) => { this.refScrollItems = ref; }}>
{ users.map(user => (
<CSSTransition
classNames={listTransition}