这里也可以复用useClickOutside,点击modal以外的区域关闭modal。但是面临一个问题,就是删除按钮也是在modal区域外的,所以会判断为isClickOutside为真,导致modal不能正常点开。我的解决方法是在useClickOutside里增加一个可选参数,接收clickOutside判断时排除在外的HTMLELEMENT(也就是在modal之外但是被算为是modal的一份...
Change the modal behaviour to prevent closing when clicking outside of the modal area.HeathU changed the title Modal should not be close when clicking outside of the modal window Modal should not close when clicking outside of the modal window Jan 31, 2020 Collaborator stsrki commented Jan ...
When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try it. Launch static backdrop modal <!-- Button trigger modal -->Launch static backdrop modal<!-- Modal -->
Alternatively, specify static for a backdrop which doesn't close the modal on click. Nice reason to make PR :) valorkin changed the title Modal closes when clicking outside of modal bug(modal): if backdrop === 'static' outside click should not close modal Jun 2, 2016 valorkin added...
To close a React.js modal on click outside, you can add an event listener to the document body during the modal's open state. When a click event occurs outside the modal, you can check if the target element is the modal itself or a child element. If not,
When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try it. Launch static backdrop modal <!-- Button trigger modal -->Launch static backdrop modal<!-- Modal -->
It also adds .modal-open to the to override default scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal.Via data attributesActivate a modal without writing JavaScript. Set data-toggle="modal" on a controller...
When backdrop is set to static, the modal will not close when clicking outside it. Click the button below to try it. Launch static backdrop modal Show code Edit in sandbox Scrolling long content When modals become too long for the user’s viewport or device, they scroll independent ...
x: Clicking the close x icon in the upper right will close the modal without submitting any data and return the user to its previous context. Click elsewhere: Clicking outside the passive modal area will automatically close the modal. Esc: Pressing ESC on the keyboard...
You might also elect to close the window when users click outside of the modal, and consider placing a “Cancel” button within the modal as an alternative to a “Continue” button. 5. Size your modal window appropriately. Modals should appear as a layer on top of the parent window. Mak...