fix incorrect focused element when using mouse to select users
This commit is contained in:
parent
34cd6daf26
commit
9e83bbee3c
@ -120,14 +120,7 @@ class Dropdown extends Component {
|
||||
const { isOpen } = this.state;
|
||||
const triggerElement = findDOMNode(this.trigger);
|
||||
const contentElement = findDOMNode(this.content);
|
||||
|
||||
if (!(triggerElement && contentElement)) return;
|
||||
if (keepOpen === null) {
|
||||
if (triggerElement.contains(event.target)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (triggerElement && triggerElement.contains(event.target)) {
|
||||
if (keepOpen) {
|
||||
onHide();
|
||||
@ -149,12 +142,6 @@ class Dropdown extends Component {
|
||||
if (keepOpen && triggerElement) {
|
||||
triggerElement.parentElement.focus();
|
||||
}
|
||||
|
||||
if (keepOpen !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.handleHide();
|
||||
}
|
||||
|
||||
handleToggle() {
|
||||
|
@ -396,7 +396,6 @@ const changeRole = (userId, role) => { makeCall('changeRole', userId, role); };
|
||||
|
||||
const roving = (event, changeState, elementsList, element) => {
|
||||
this.selectedElement = element;
|
||||
|
||||
const menuOpen = Session.get('dropdownOpen') || false;
|
||||
|
||||
if (menuOpen) {
|
||||
|
@ -84,10 +84,13 @@ class UserParticipants extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.refScrollContainer.removeEventListener('keydown', this.rove);
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
const isPropsEqual = _.isEqual(this.props, nextProps);
|
||||
const isStateEqual = _.isEqual(this.state, nextState);
|
||||
|
||||
return !isPropsEqual || !isStateEqual;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,6 @@ const propTypes = {
|
||||
};
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
const CHAT_ENABLED = Meteor.settings.public.chat.enabled;
|
||||
const noop = () => {};
|
||||
|
||||
class UserDropdown extends PureComponent {
|
||||
/**
|
||||
@ -154,6 +153,8 @@ class UserDropdown extends PureComponent {
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { dropdownVisible } = this.props;
|
||||
if (!dropdownVisible) document.activeElement.blur();
|
||||
this.checkDropdownDirection();
|
||||
}
|
||||
|
||||
@ -196,8 +197,7 @@ class UserDropdown extends PureComponent {
|
||||
return callback;
|
||||
}
|
||||
|
||||
Session.set('dropdownOpen', false);
|
||||
return noop;
|
||||
return Session.set('dropdownOpen', false);
|
||||
}
|
||||
|
||||
getUsersActions() {
|
||||
|
Loading…
Reference in New Issue
Block a user