How to prevent close action when clicking specific target in React Sidebar component?
The following steps used to prevent the Sidebar from close when clicking specific target with closeOnDocumentClick property enabled.
|
function OnClose(args)
{ if (args.event?.target.classList.contains('e-list-item')) { args.cancel = true; } } return ( <div className="control-section"> <div id="wrapper"> {/* Initializing the Sidebar component */} <SidebarComponent .... close={OnClose} > ..... </SidebarComponent> </div> </div> );
|
Sample : Sidebar-DropdownList-CloseOnDocumentClick (forked) - StackBlitz
See Also :