Skip to content

Releases: microcmsio/react-hooks-use-modal

v3.3.1

24 Jan 02:00
2203634
Compare
Choose a tag to compare

Fixes

Future hook

What's Changed

Full Changelog: v3.3.0...v3.3.1

v3.3.0

19 Jan 05:54
f538ab9
Compare
Choose a tag to compare

New Future Hooks

A new useModal hook has been released.
Instead of returning a modal component constructed with a div element as before, it returns a modal component constructed with a dialog element.
Please note that the usage is almost the same, but some unnecessary options have been removed.

import { useModal } from 'react-hooks-use-modal/future'

const [Modal, open, close, isOpen] = useModal();

Features

What's Changed

New Contributors

Full Changelog: v3.2.0...v3.3.0

v3.2.0

28 Oct 08:54
fa24222
Compare
Choose a tag to compare

What's Changed

  • Support React 18 and adjust the example code. by @kato83 in #65

New Contributors

Full Changelog: v3.1.0...v3.2.0

v3.1.0

08 Sep 00:55
Compare
Choose a tag to compare

Features

  • The initialValue option allows you to set an initial value. By #59
  • Custom modal component props that can be specified with the components option can now be passed as non-prescriptive props. By #60

What's Changed

  • Add initialValue option. by @dc7290 in #59
  • Add additionalProps props that can be specified in Modal. by @dc7290 in #60
  • Update version 3.1.0 by @dc7290 in #62

Full Changelog: v3.0.1...v3.1.0

v3.0.1

06 Sep 08:31
7fc662c
Compare
Choose a tag to compare

Fixes

  • Fixed unneeded side-effect cleanup when re-rendering occurred. By #57

What's Changed

  • Fixed useFocusTrap's useEffect being activated when re-rendering by @dc7290 in #57
  • Update version to 3.0.1 by @dc7290 in #58

Full Changelog: v3.0.0...v3.0.1

v3.0.0

05 Sep 01:43
73363b5
Compare
Choose a tag to compare

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

v2.1.0

08 Sep 09:18
Compare
Choose a tag to compare

add option that don't close on overlay click. #24
Fix: webpack resolve extensions tsx -> .tsx #29

Change

Add closeOnOverlayClick options.

const [Modal, open, close, isOpen] = useModal('root', {
  preventScroll: true,
  closeOnOverlayClick: false
});

Special thunks. @Shinyaigeek and @kuroppe1819

v2.0.2

26 Aug 07:09
Compare
Choose a tag to compare

Change

fix: changed from memo to useCallback. #22

v2.0.1

25 Aug 07:58
Compare
Choose a tag to compare

Added TypeScript support. There are some changes.

Change

  • Support TypeScript
  • Added GitHub Actions
  • Change from export default to export. When library importing, it will be as follows.
import { useModal } from 'react-hooks-use-modal'
  • Change from babel to microbundle. Added some npm commands.
// build src
npm run build

// watch src
npm run watch

v1.1.0

11 Aug 00:29
Compare
Choose a tag to compare
  • Added support for React v17.
  • Updated some packages.