"jsx-a11y/aria-activedescendant-has-tabindex": 1,
"jsx-a11y/aria-role": 1,
"jsx-a11y/click-events-have-key-events": 1,
- "jsx-a11y/iframe-has-title": 1,
"jsx-a11y/interactive-supports-focus": 1,
- "jsx-a11y/no-redundant-roles": 1,
"jsx-a11y/no-static-element-interactions": 1,
"jsx-a11y/role-has-required-aria-props": 1,
"curly": 0,
this.state = this.emptyState;
this.handleEmojiClick = this.handleEmojiClick.bind(this);
}
+
+ closeEmojiMartOnEsc(i, event) {
+ event.key === "Escape" && i.setState({ showPicker: false });
+ }
+
render() {
return (
<span className="emoji-picker">
{this.state.showPicker && (
<>
- <div className="position-relative">
- <div className="emoji-picker-container position-absolute w-100">
+ <div className="position-relative" role="dialog">
+ <div className="emoji-picker-container z-3">
<EmojiMart
onEmojiClick={this.handleEmojiClick}
pickerOptions={{}}
togglePicker(i: EmojiPicker, e: any) {
e.preventDefault();
i.setState({ showPicker: !i.state.showPicker });
+
+ i.state.showPicker
+ ? document.addEventListener("keyup", e => i.closeEmojiMartOnEsc(i, e))
+ : document.removeEventListener("keyup", e => i.closeEmojiMartOnEsc(i, e));
}
handleEmojiClick(e: any) {