Fix two different drop-down menus opening twice

This commit is contained in:
noellabo 2021-09-03 08:30:56 +09:00
parent 8837025376
commit 1c5d0b8ce1
2 changed files with 7 additions and 11 deletions

View file

@ -180,7 +180,7 @@ export default class Dropdown extends React.PureComponent {
onOpen: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
dropdownPlacement: PropTypes.string,
openDropdownId: PropTypes.number,
openDropdownId: PropTypes.string,
openedViaKeyboard: PropTypes.bool,
};
@ -189,7 +189,7 @@ export default class Dropdown extends React.PureComponent {
};
state = {
id: id++,
id: `action:${id++}`,
};
handleClick = ({ target, type }) => {
@ -211,10 +211,8 @@ export default class Dropdown extends React.PureComponent {
}
handleMouseDown = () => {
if (!this.state.open) {
this.activeElement = document.activeElement;
}
}
handleButtonKeyDown = (e) => {
switch(e.key) {

View file

@ -30,7 +30,7 @@ const messages = defineMessages({
});
const listenerOptions = supportsPassiveEvents ? { passive: true } : false;
let id = 100;
let id = 0;
let EmojiPicker, Emoji; // load asynchronously
@ -307,7 +307,7 @@ export default class ReactionPickerDropdown extends React.PureComponent {
onOpen: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
dropdownPlacement: PropTypes.string,
openDropdownId: PropTypes.number,
openDropdownId: PropTypes.string,
openedViaKeyboard: PropTypes.bool,
custom_emojis: ImmutablePropTypes.list,
onPickEmoji: PropTypes.func.isRequired,
@ -325,7 +325,7 @@ export default class ReactionPickerDropdown extends React.PureComponent {
};
state = {
id: id++,
id: `reaction:${id++}`,
};
handleClick = ({ target, type }) => {
@ -349,10 +349,8 @@ export default class ReactionPickerDropdown extends React.PureComponent {
}
handleMouseDown = () => {
if (!this.state.open) {
this.activeElement = document.activeElement;
}
}
handleButtonKeyDown = (e) => {
switch(e.key) {