revite icon indicating copy to clipboard operation
revite copied to clipboard

bug: regression: pressing Esc while previewing an image does not dismiss it

Open infi opened this issue 3 years ago • 3 comments

What happened?

Previewing an image and subsequently pressing Esc should dismiss the preview as it has before.

Instead, nothing happens anymore.

image

Branch

Nightly (nightly.revolt.chat)

Commit hash

a190a51d0b597370e66de96f7c94592debb7705c

What browsers are you seeing the problem on?

Chrome, Microsoft Edge

Relevant log output

No response

Desktop

  • [ ] Yes, this bug is specific to Revolt Desktop and is not an issue with Revolt Desktop itself.

PWA

  • [ ] Yes, this bug is specific to the PWA.

infi avatar Jun 14 '22 21:06 infi

Can also reproduce on Firefox using Nightly.

Rexogamer avatar Jun 14 '22 22:06 Rexogamer

this is because the ImageViewer is now using the UI library https://github.com/revoltchat/revite/blob/a190a51d0b597370e66de96f7c94592debb7705c/src/context/intermediate/popovers/ImageViewer.tsx#L6

the old modal component had the following (which listened for "Escape" key clicks):

useEffect(() => {
    if (props.disallowClosing) return;

    function keyDown(e: KeyboardEvent) {
        if (e.key === "Escape") {
            onClose();
        }
    }

    document.body.addEventListener("keydown", keyDown);
    return () => document.body.removeEventListener("keydown", keyDown);
}, [props.disallowClosing, onClose]);

changed in https://github.com/revoltchat/revite/commit/41e533ab59ef2f32554632e417ffff6b1ad31cca

LedaThemis avatar Jun 14 '22 22:06 LedaThemis

Fixed in 0d3f29515e3ec8f1aab179914aa6634d323b2ded, ImageViewer now uses ModalController which depends on ModalRenderer that has the following: https://github.com/revoltchat/revite/blob/f79288826849d0a6e64cb4e1e85b2830ccecc47b/src/controllers/modals/ModalRenderer.tsx#L13-L14

LedaThemis avatar Jul 10 '22 13:07 LedaThemis

Closing due to rewrite, marking as potential issue in future by linking to https://github.com/revoltchat/frontend/issues/134.

insertish avatar Jan 24 '23 16:01 insertish