All Projects â†’ theKashey â†’ React Locky

theKashey / React Locky

Licence: mit
"🔒-y" – Asgardian God of Event Scoping 📦, Scroll Locking 📜, Silence Casting 🙊

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Locky

React Focus On
🎯 Solution for WAI ARIA compatible modal dialogs or full-screen tasks, you were looking for
Stars: ✭ 180 (+27.66%)
Mutual labels:  lock, scroll
focus-trap-vue
Vue component to trap the focus within a DOM element
Stars: ✭ 156 (+10.64%)
Mutual labels:  a11y, lock
Core Components
Accessible and lightweight Javascript components
Stars: ✭ 85 (-39.72%)
Mutual labels:  a11y, scroll
React Video Scroll
A React component to seek or control the video frame rate on scroll.
Stars: ✭ 114 (-19.15%)
Mutual labels:  scroll
Adg
Accessibility Developer Guide
Stars: ✭ 117 (-17.02%)
Mutual labels:  a11y
Svelte Navigator
Simple, accessible routing for Svelte
Stars: ✭ 125 (-11.35%)
Mutual labels:  a11y
Node Proper Lockfile
An inter-process and inter-machine lockfile utility that works on a local or network file system.
Stars: ✭ 139 (-1.42%)
Mutual labels:  lock
React Scroll Parallax
🔮 React components to create parallax scroll effects for banners, images or any other DOM elements
Stars: ✭ 1,699 (+1104.96%)
Mutual labels:  scroll
Radio Group
845 byte WAI-ARIA 1.1 compliant radio group React component
Stars: ✭ 133 (-5.67%)
Mutual labels:  a11y
Ember A11y Testing
A suite of accessibility tests that can be run within the Ember testing framework
Stars: ✭ 125 (-11.35%)
Mutual labels:  a11y
Guide Integrateur
Un guide destiné aux intégrateurs chargés de réaliser des gabarits HTML et CSS accessibles.
Stars: ✭ 125 (-11.35%)
Mutual labels:  a11y
Live Mutex
High-performance networked mutex for Node.js libraries.
Stars: ✭ 118 (-16.31%)
Mutual labels:  lock
A11y Dialog
A very lightweight and flexible accessible modal dialog script.
Stars: ✭ 1,768 (+1153.9%)
Mutual labels:  a11y
Top People To Follow In Web Accessibility
A list of the top people to follow in web accessibility and web standards.
Stars: ✭ 117 (-17.02%)
Mutual labels:  a11y
Ebayui Core
Collection of Marko widgets; considered to be the core building blocks for all eBay components, pages & apps
Stars: ✭ 134 (-4.96%)
Mutual labels:  a11y
Poetry Pycharm Plugin
A PyCharm plugin for poetry
Stars: ✭ 113 (-19.86%)
Mutual labels:  lock
Parvus
An accessible, open-source image lightbox with no dependencies.
Stars: ✭ 124 (-12.06%)
Mutual labels:  a11y
Macos Lock
Lock your Mac from the command-line
Stars: ✭ 123 (-12.77%)
Mutual labels:  lock
Pa11y Webservice
Pa11y Webservice provides scheduled accessibility reports for multiple URLs
Stars: ✭ 122 (-13.48%)
Mutual labels:  a11y
Skin
Pure CSS framework designed & developed by eBay for a branded, e-commerce marketplace.
Stars: ✭ 126 (-10.64%)
Mutual labels:  a11y

react-locky

CircleCI status Greenkeeper badge


NPM

Loki - is God of Mischief, Madness and Evil!

Locky - is God of Locks, Event capturing and Stealing. Small and very slender brother - just 1.7kb.

Locky will never let event escape the target node, will prevent scrolls outside, will do the HTML5 inert job. Locky will completely disable any user iterations outside of nested children.

import Locky from 'react-locky';

 <div>
     <Button>You will be unable to press</Button>
     <Scrollable>You will be unable to scroll</Scrollable
     
     <Locky>
        <Button>You will be ABLE to press</Button>
        <Scrollable>You will be able to scroll</Scrollable
     </Locky>
     
     // you can tune behavior
     <Locky events={{keydown: false}}>
       // Locky got everything, except keydown        
     </Locky>
 </div>

In case you need to lock only scroll

 <Locky noDefault events={{scroll: true}}> .... </Locky>

API

Locky accepts a few props.

  • enabled[=true], controls Locky behavior.
  • onEscape, will be triggered when someone will try "escape" the lock. See "report" events below
  • noDefault[=false], disables all "default" events
  • events[=defaultEvents], DOM events to manage
  • group[=null], focus group id. Locks with the same group will not block each other. You may setup groups manually by adding data-locky-group={name} attribute anywhere.
  • component[=div], allows to replace HTML tag.
  • className[=null], Locky will forward className to component.
  • headless[=false], Locky will not create component, but will use the first node inside it (groups will probably not work).
  • leaded[=false], Locky will work only with "group" leader - mounted last instance for the provided group.

Default events

  • click: 'report' (will call onEscape)
  • mousemove: true,
  • mousedown: 'report' (will call onEscape)
  • touchmove: true,
  • touchstart: 'report' (will call onEscape)
  • keydown: true,
  • focus: false, (focus is unblockable)
  • change: false,
  • scroll: true, (scroll is handled separately)
  • wheel: true,

Example

Tip

Probably you don't need to hook a keyboard. It will also block page refresh events.

<Locky events={{keydown:false}} />

important tip for Mobile Safary - while normal "touch move" will scroll "scrollable" container, touch+move started on inputs will start drag-n-drop and cause whole layer(modal/page) scroll. (it will just scroll as a 💩, or not scroll at all).

To disable this behavior - apply -webkit-overflow-scrolling: touch; on the page.

Locky in non-headless mode will produce a div. That div could be something you dont want to have. Feel free to set a className prop, with class holding display:inline - as a result parasite div will shrink to 1 pixel.

Other usages

Just track clicks outside your element

<Locky noDefault events={{click:'report-only'}} onEscape={onOuterElementClick}>
  ...your content
</Locky>

More tools

Locky also exposes LockyTransparent component, which makes everything inside invisible to Locky

import {LockyTransparent} from 'react-locky';

<LockyTransparent>this content will be "locky"-free</LockyTransparent>

ScrollBars

Locks will not hide your scroll bars! And there is no way to prevent scrolling using the scroll bars. You have to use react-scrolllock to complitely disable scroll, or Strollable from react-stroller to hide scroll bars.

Article

Related

Locky could not manage focus itself, as long there is no way to "preventDefault" it. Once you will "tab-out", you will not be able to "tab-in", as long key events are blocked.

<Locky noDefault events={{scroll:true}} /> will do almost the same, but differently. As long react-scroll-captor manage "scroll" for children, locky could manage scroll for any target inside. Ie - if you have scrollable, inside scrollable, or scrollable is not a top-most node - react-scroll-captor will not work, while Locky will.

Licence

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].