Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(popover): close hover menu on escape
Rishi Bhardwaj3e0f806212e8
diff --git a/react/features/base/popover/components/Popover.web.tsx b/react/features/base/popover/components/Popover.web.tsxindex 0052f2765f..416552bae2 100644--- a/react/features/base/popover/components/Popover.web.tsx+++ b/react/features/base/popover/components/Popover.web.tsx@@ -192,12 +192,31 @@ class Popover extends Component<IProps, IState> {*/override componentDidMount() {window.addEventListener('touchstart', this._onOutsideTouchStart);+ if (this.props.visible) {+ window.addEventListener('keydown', this._onEscKey);+ }if (this.props.trigger === 'click') {// @ts-ignorewindow.addEventListener('click', this._onOutsideClick);}}+ /**+ * Attaches/removes the global Escape key listener as visibility changes.+ *+ * @inheritdoc+ * @returns {void}+ */+ override componentDidUpdate(prevProps: IProps) {+ if (prevProps.visible !== this.props.visible) {+ if (this.props.visible) {+ window.addEventListener('keydown', this._onEscKey);+ } else {+ window.removeEventListener('keydown', this._onEscKey);+ }+ }+ }+/*** Removes the listener set up in the {@code componentDidMount} method.*@@ -206,6 +225,7 @@ class Popover extends Component<IProps, IState> {*/override componentWillUnmount() {window.removeEventListener('touchstart', this._onOutsideTouchStart);+ window.removeEventListener('keydown', this._onEscKey);if (this.props.trigger === 'click') {// @ts-ignorewindow.removeEventListener('click', this._onOutsideClick);@@ -453,7 +473,7 @@ class Popover extends Component<IProps, IState> {** @returns {void}*/- _onEscKey(e: React.KeyboardEvent) {+ _onEscKey(e: KeyboardEvent | React.KeyboardEvent) {if (e.key === 'Escape') {e.preventDefault();e.stopPropagation();