Skip to content

bug: LdModal calls ldmodalclosed event 2 times on single modal close #1164

@ssuchkov

Description

@ssuchkov

Prerequisites

Liquid version

5.14.0

Framework bindings

React

Current behavior

LdModal calls ldmodalclosed 2 times on modal close.

Expected behavior

LdModal calls ldmodalclosed 1 time on modal close.

Steps to reproduce

code like this reveals is

const modalRef = useRef(null)

return (
  <>
    <LdModal blurryBackdrop ref={modalRef} onLdmodalclosed={() => alert('Modal closed')}>
      <LdTypo style={{ textAlign: 'center' }}>I'm a modal dialog.</LdTypo>
    </LdModal>

    <LdButton onClick={() => modalRef.current.showModal()}>
      Open Modal
    </LdButton>
  </>
)

Code reproduction URL

https://stackblitz.com/edit/github-lmnmdfxu?file=src%2FApp.tsx

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue describing unexpected or malicious behaviour.confirmedThis label indicates that the issue has been reproduced and verified by the core team.has workaroundA workaround exists to handle the issue until it is fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions