question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Discussion for v4 of react-modal

See original GitHub issue

First, thanks for all the support through the years…reporting and answering issues, or submitting PRs. You guys are great.

I try my best to find time to help improve this package, but I can’t do it alone…

I have a dream to finally release version 4 for react-modal, but I didn’t have a good goal to invest time to push it forward.

The goals for v4:

  1. Remove from the API everything that can disable accessibility

It would be better to have a more stable releases without breaking accessibility.

  1. Fix the bogus default behavior related to hide the application.

The default is to apply the aria-hidden attribute to the document.body. But this hides everything

This will require the user to explicitly define the element(s), using its id or class or element, using Modal.setAppElement().

To normalize the API, Modal.setAppElement() and appElement={} must use arrays to keep the API simple.

  1. Deprecate ariaHideApp

This is an unnecessary flag, this behavior can be archived by passing [] to Modal.setAppElement() and appElement={}. But it shouldn’t be recommended.

  1. Deprecate shouldFocusAfterRender={boolean}

The modal must always gain focus and trap (correctly).

  1. Replace shouldReturnFocusAfterClose={boolean} with returnFocusTo={Element}

This can be an element that will gain focus after the modal is closed.

The default behavior is to return the focus to the element on document.activeElement before open the modal, but…in some browsers, this behavior is broken so we can’t always trust it. So, the user can pass to this attribute an element that must receive the focus later.

  1. Review all additional systems that react-modal uses (see helpers folder)

This package manages a lot of state (like open instances, styles classes added to external elements, focus system…)


With this goals in mind, the API will be less flexible to disable the features related to accessibility, which should not be a problem, but maybe some users will not see this a gain…So, I decided to start a discussion before moving forward with this…

I’ll let this open until the end of Jun, and if the feedback is positive, I’ll set up the project so everybody can participate!

Thanks, Dias

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:43
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
diasbrunocommented, Jun 19, 2021

@alterfo Users are free to create the animation with css. Was it difficult to add animations, or, should this package provides some options built-in?

The reason this package doesn’t provide any animations is to not add unnecessary files.

13reactions
alterfocommented, Jun 18, 2021

add animations please, it appears roughly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Practical React - 4 - Modal - YouTube
Practical React - 4 - Modal. Watch later. Share. Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, try restarting ......
Read more >
Build a full-featured Modal dialog Form with React
In this tutorial, you'll create a form in a modal with React. The Modal pops up on a button click. A form is...
Read more >
4 steps to set up global modals in React - Opensource.com
1. Create a global modal component · 2. Create modal dialog components · 3. Integrate GlobalModal into the top-level component in your application....
Read more >
Working with Bootstrap's Modals in React | Pluralsight
Modals are very common in front-end applications. React-bootstrap has rebuilt the jQuery-based modal with React components that provide the ...
Read more >
Top React modal components for 2021 - LogRocket Blog
It offers a fully customizable modal component with easy-to-use features. You can resize the modal component as per your requirements with the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found