Skip to content

v3.0.0

Choose a tag to compare

@dc7290 dc7290 released this 05 Sep 01:43
· 36 commits to master since this release
73363b5

Major version released 🎉.

This release primarily includes accessibility improvements, extensibility enhancements, and convenience improvements.

Breaking Changes.

The closeOnOverlayClick option is no longer used.

Previously, to prevent clicking outside of a modal from closing it, the

useModal('root', {
  closeOnOverlayClick: false
})

but starting with this release, it has been changed to following.

useModal('root', {
  focusTrapOptions: {
    clickOutsideDeactivates: false,
  },
})

This is because focus-trap, a library used internally to solve problems around focus traps, is also responsible for non-modal clicks.
Therefore, to prevent a click outside of a modal from trapping the modal, specify focusTrapOptions.

A warning is now issued when there is no single focusable element in the modal.

WAI-ARIA 1.1 states that there should be at least one focusable element in the modal.
As a workaround, if there is no focusable element in the modal, the focus is given to the containing element.
Reference: https://www.w3.org/TR/wai-aria-1.1/#dialog

Features

  • A ModalProvider component has been implemented to share global settings. By #50 and #55 and #28
  • The components option allows customization of the default modal elements. By #56
  • Focus trapping is now automatic in the modal. by #46
    Sorry @dqn and @kuroppe1819.
    There were some considerations after merging the two PRs and we made the decision to use focus-trap.
  • disable-scroll has been changed to body-scroll-lock. by #28 and #45

Fixes

  • Fixed problem with modal close button not closing with space key. Related to #27
  • Remove unnecessary z-index values.

What's Changed

New Contributors

Full Changelog: v2.1.0...v3.0.0