Comments (7)
Released as v2.9.5
.
Change is not yet propagated to https://github.com/theKashey/react-focus-on, please help me understand theKashey/react-focus-on#74 (comment) first
from react-focus-lock.
bug confirmed 😭
from react-focus-lock.
Thanks for the quick repro Anton!
Not sure if this is helpful or not, but @tkajtoch and I were testing crossFrame
in react-focus-on
locally in our codebase's Storybook, and were also getting that same behavior as well even in Chrome and FF and couldn't figure out why or what was happening (code was almost identical to the above CodeSandbox). We eventually figured out it was the setTimeout 0
in onWindowBlur
race condition:
https://github.com/theKashey/react-focus-lock/blob/master/src/Trap.js#L185-L187
We changed the above setTimout duration from 0
to 1
and the crossFrame behavior started working for us locally. Maybe give it a shot on your end and see if it fixes Safari behavior as well? 🤞
from react-focus-lock.
😲 onBlur is executed "a little later" using a deferAction
helper of mine - https://github.com/theKashey/react-focus-lock/blob/master/src/util.js#L7
It works exactly via setTimeout(..,1)
- you have found the root case.
Well, it uses setTimeout only in the absence of setImmediate
, which may or may not be polyfilled by a bundler.
from react-focus-lock.
Oooh! It all makes sense now 🤦 All the credit goes to @tkajtoch for figuring out that changing setTimeout fixed the behavior!
Would changing onWindowBlur
to use deferAction
be a clean solution, or would just changing the 0
to a 1
on its timeout suffice? 🤔
from react-focus-lock.
deferAction
is a way to go. Tested in Chrome and safari - works great.
from react-focus-lock.
I think @tkajtoch is working on that - will keep you posted! Thanks as always for being amazingly responsive and speedy Anton!
from react-focus-lock.
Related Issues (20)
- Socket dev picking up some security issues. HOT 3
- Add an `onError` callback for when focus fighting is detected HOT 2
- Feature request - Clickaway deactivation HOT 2
- Can't click without scroll being changed HOT 3
- Invalid hook call when using it inside a library HOT 3
- Issue with importing FocusLock component HOT 18
- /*#__PURE__*/ comment throws warning in Rollup HOT 3
- Unclear behavior during loosing focus in unmanaged area HOT 3
- Migrate to Typescript HOT 1
- Remove sidecar HOT 1
- useFocusLock HOT 1
- Version `2.11.0` doesn't compile with TS HOT 1
- Returning focus to element inside an iframe HOT 2
- ESM compatibility breaks WebPack build HOT 18
- added file extension in imports as it was breaking in webpack 5 HOT 2
- version 2.12.0 , feature "ESM Compatible" breaks React app CRA build with Chackra UI HOT 3
- Module Resolution Error: Missing File Extensions in Import Statements HOT 2
- Typo in readme HOT 3
- onDeactivation callback is called on render in StrictMode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-focus-lock.