Git Product home page Git Product logo

react-locky's Introduction

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

react-locky's People

Contributors

greenkeeper[bot] avatar sievertknorrblad avatar stereobooster avatar thekashey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-locky's Issues

An in-range update of babel7 is breaking the build 🚨

There have been updates to the babel7 monorepo:

    • The devDependency @babel/cli was updated from 7.1.2 to 7.1.5.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the babel7 group definition.

babel7 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of regenerator-runtime is breaking the build 🚨

The devDependency regenerator-runtime was updated from 0.13.2 to 0.13.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

regenerator-runtime is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-react is breaking the build 🚨

The devDependency eslint-plugin-react was updated from 7.14.2 to 7.14.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

Release Notes for v7.14.3

Fixed

  • Fix prop-types to ignore validation when Flow indexers are used (#2330 @yannickcr)
  • Fix error being thrown after the first warning when react version cannot be detected (#2336 @abhishekdev)
  • Fix component detection when memo and forwardRef are used together (#2349 @yannickcr)

Changed

Commits

The new version differs by 14 commits.

  • 47c4c8b Update CHANGELOG and bump version
  • 98d4bf3 Fix component detection when memo and forwardRef are used together
  • fc70077 Merge pull request #2354 from golopot/patch-1
  • f2891d9 [docs] remove outdated docs for no-unused-prop-types
  • 49343d4 [meta] add github sponsorship
  • 562e441 Add Tidelift badge to README
  • b684e87 Add SECURITY file
  • 22a3740 Add FUNDING file
  • e835aaf add note about global installs being deprecated
  • 0215c38 Merge pull request #2336 from abhishekdev/handle-react-detect-errors
  • 8fbf50c version detection: Do not throw a raw error after the first warning
  • f59e927 version detection: Add tests
  • d6832d6 Fix new required import order
  • bc67d42 Fix prop-types to ignore validation when Flow indexers are used

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of storybook is breaking the build 🚨

There have been updates to the storybook monorepo:

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the storybook group definition.

storybook is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

Release Notes for v5.0.11

Bug Fixes

  • Polymer: Fix re-rendering lit-html elements after non-lit-html element (#5868)
  • Addon-knobs: Check color knob value before applying uppercase (#6598)
  • Angular: Fix sourceMap property of angulars webpack config (#6535)
Commits

The new version differs by 19 commits.

  • 17b0a5c v5.0.11
  • 7eb0fcc 5.0.11 changelog
  • d4efa91 Merge pull request #5868 from storybooks/fix/lit-html
  • b7be50d Add missing props in stories (#6353)
  • bfa85c9 Merge pull request #6598 from binomialstew/bugfix/6597
  • 43b3136 Merge pull request #6535 from aspidov/next
  • c901911 Fix bad markdown instructions (#6654)
  • 262511b Merge pull request #6494 from storybooks/fix/clean-up-theming-docs
  • 28a37b4 Fix "Storybook for HTML" Edit link (#6658)
  • a6dcc06 Fix isFullscreen typo (#6628)
  • 7e51c71 DOCS improve registration in VueJs guide (#6608)
  • d587300 Fix: add need comma to sample code (#6606)
  • 32698cc Merge branch 'master' of github.com:storybooks/storybook
  • 7a15631 5.1.0-alpha.36 next.json version file
  • 46e2662 Update index.md (#6513)

There are 19 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/react is breaking the build 🚨

The devDependency @types/react was updated from 16.4.16 to 16.4.17.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of enzyme is breaking the build 🚨

There have been updates to the enzyme monorepo:

    • The devDependency enzyme was updated from 3.6.0 to 3.7.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the enzyme group definition.

enzyme is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of size-limit is breaking the build 🚨

The devDependency size-limit was updated from 0.21.0 to 0.21.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

size-limit is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Only one locky is supported

Locky should support LIFO activation order, as focus lock does.

Currently - 2 active locky on the page would block everything - document, body, and eachother.

loose: true break the lib

document.querySelectorAll is not an Array and does not have .concat method.

Without loose: true

var freeNodes = _toConsumableArray(document.querySelectorAll("[".concat(LOCKY_TRANSPARENT, "=\"true\"]")));

With loose: true

var freeNodes = document.querySelectorAll("[" + LOCKY_TRANSPARENT + "=\"true\"]").concat();

An in-range update of react is breaking the build 🚨

There have been updates to the react monorepo:

    • The devDependency react was updated from 16.5.2 to 16.6.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the react group definition.

react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-import is breaking the build 🚨

The devDependency eslint-plugin-import was updated from 2.18.0 to 2.18.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

Commits

The new version differs by 14 commits.

  • b51aa2f Bump to v2.18.1
  • 32704da fix: Improve parse perf when using @typescript-eslint/parser
  • 3b21de6 [Tests] extract common "get parser" logic into test helpers
  • f4e3f1b prefer-default-export: don't warn on TypeAlias & TSTypeAliasDeclaration
  • 1caa402 [Fix] no-unused-modules: Exclude package "main"/"bin"/"browser" entry points
  • 22d5440 [fix] export: false positive for typescript overloads
  • 5abd5ed [Tests] temporarily disable these failing tests in eslint < 4
  • 752dcd5 [Tests] add missing --no-save to time travel script
  • d3a3fa5 [Refactor] no-extraneous-dependencies: remove the last bit of lodash
  • 8a38fd4 [Refactor] no-extraneous-dependencies: use Array.isArray instead of lodash
  • c5078ad [Refactor] importType: remove use of cond
  • 118afd4 no-deprecated: don't run tests for typescript-eslint-parser against ESLint <4
  • 6512110 fix tests for node 4 + fixed lint issues
  • bb9ba24 no-deprecated TS tests (#1315)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Support groups

Groups were very handy with focus-lock, and could be even more handy with locky, as long it is a bit more agressive.

Group is just a data attribute, and all nodes with the same group, equal to the "active" one, should pass events.

An in-range update of enzyme is breaking the build 🚨

There have been updates to the enzyme monorepo:

    • The devDependency enzyme was updated from 3.6.0 to 3.7.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the enzyme group definition.

enzyme is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-mocha is breaking the build 🚨

The devDependency eslint-plugin-mocha was updated from 5.2.1 to 5.3.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

Release Notes for 5.3.0

Features

  • Implement no-async-describe rule (#188)
Commits

The new version differs by 7 commits.

  • d36c149 5.3.0
  • 4449a3d Merge pull request #188 from papandreou/feature/no-async-describe
  • 0c113b5 Simplify the fixer
  • a5fa46a Fix error message
  • 7c9b6dc Review fixes
  • d1ffa55 Fix wrong string-less describe in test cases
  • e509877 Implement no-async-describe rule

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of enzyme is breaking the build 🚨

There have been updates to the enzyme monorepo:

    • The devDependency enzyme was updated from 3.6.0 to 3.7.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the enzyme group definition.

enzyme is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of enzyme is breaking the build 🚨

There have been updates to the enzyme monorepo:

    • The devDependency enzyme was updated from 3.7.0 to 3.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the enzyme group definition.

enzyme is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of babel-plugin-transform-react-remove-prop-types is breaking the build 🚨

The devDependency babel-plugin-transform-react-remove-prop-types was updated from 0.4.20 to 0.4.21.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

babel-plugin-transform-react-remove-prop-types is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • ❌ ci/circleci: Your tests failed on CircleCI (Details).

Release Notes for v0.4.21
  • Add support for defining additionalLibraries as a regexp expression (#174) @pkuczynski
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.