Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
React component for handling clicks and focuses outside, which works with portals
React component for handling clicks and focuses outside
import Foco from 'react-foco';
const MyComponent3000 = () => (
<Foco
onClickOutside={() => console.log('Click Outside')}
onFocusOutside={() => console.log('Focus Outside')}
>
<button>Click Me</button>
{React.createPortal(<MyAnotherComponent />, portalNode)}
</Foco>
);
https://github.com/nanot1m/react-foco/releases
onClickOutside
— function called on clicks outside of wrapping nodesonFocusOutside
— function called on focus outside of wrapping nodesrender
— prop allows for inline rendering foco contentclassName
— class passed to wrapping nodestyle
— object with css properties passed to wrapping nodechildren
— children react elements or function the same as prop render
component
— component or tag which is used to render wrapper nodeThis prop are passed for callback in props render or children
className?: string
— class name provided from Foco componentstyle?: React.CSSProperties
— styles provided from Foco componentonMouseDown: React.MouseEventHandler
— handler for checking clicks outsideonFocus: React.FocusEventHandler
— handler for checking focuses outsideonTouchStart: React.TouchEventHandler
— handler for checking touches outsidefunction MyComponent() {
return (
<Foco onClickOutside={() => alert('click out')}>
{wrapperProps => (
<div
{...wrapperProps}
style={{ border: '1px solid skyblue', textAlign: 'center' }}
>
<p>Hola! Clicks outside would trigger alerts</p>
</div>
)}
</Foco>
);
}
yarn storybook
yarn test
FAQs
React component for handling clicks and focuses outside, which works with portals
The npm package react-foco receives a total of 861 weekly downloads. As such, react-foco popularity was classified as not popular.
We found that react-foco demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.