eBay / eBay/nice-modal-react

[Request] Add default to remove modal

Open
#131 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
127
PR merge metrics
No merged PRs in 30d

Description

I have been using this package for a long time in a lot of projects and recently ive noticed a lot of issues regarding modals mounting and un-mounting especially with forms.

Most UI packages have modals built with open / closing animations and id like to use that closing animation, so if I just call modal.remove() the animation is not displayed. Ive tried to do an async call like this:

const handleClose = async () => {
  return modal.hide().then(() => modal.remove())
}

however in that scenario I have noticed that the modals are not actually being removed from the component tree and if I were to open that modal again, the form values still display the values of the previous modal because it did not get removed and re-rendered.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the modal.hide() and modal.remove() APIs and reproduce the reported form-state behavior with a closing animation. Trace how hiding and removing affect the component tree, then define the default removal behavior so the animation can complete while the modal is actually unmounted and reopened forms do not retain prior values.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.