Skip to content

Commit

Permalink
[web] Fix closing MultimediaModal on ESC press bug
Browse files Browse the repository at this point in the history
Summary:
Fix for [ENG-4327](https://linear.app/comm/issue/ENG-4327/allow-esc-to-close-imagemodal-on-web).

This diff solves the issue, where closing MultimediaModal with the ESC key was impossible.

Test Plan: In chat, click on the image and when MultimediaModal is shown, check if ESC key press closes it. Tested on unencrypted and encrypted images.

Reviewers: bartek, tomek, ashoat

Reviewed By: ashoat

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D8498
  • Loading branch information
pklatka committed Jul 17, 2023
1 parent c92d32a commit 8ba42dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions web/media/media.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ div.multimediaModalOverlay > .mediaContainer {
width: 100%;
height: 100%;
}
div.multimediaModalOverlay > .mediaContainer:focus {
outline: none;
}
div.mediaContainer > img,
div.mediaContainer > video {
width: auto;
Expand Down
9 changes: 6 additions & 3 deletions web/media/multimedia-modal.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,13 @@ class MultimediaModal extends React.PureComponent<Props, State> {
<div
className={css.multimediaModalOverlay}
onClick={this.onBackgroundClick}
tabIndex={0}
onKeyDown={this.onKeyDown}
>
<div ref={this.overlayRef} className={css.mediaContainer}>
<div
ref={this.overlayRef}
className={css.mediaContainer}
tabIndex={0}
onKeyDown={this.onKeyDown}
>
{mediaModalItem}
</div>
<XCircleIcon
Expand Down

0 comments on commit 8ba42dc

Please sign in to comment.