Comments (5)
Can't really reproduce in there, but I did made an example at https://codesandbox.io/embed/react-color-example-59-forked-1kezj7?fontsize=14&hidenavigation=1&theme=dark
The bug is when clicking the "Done" that hides the color picker... but it only happens when using iframes from another website. In my case, in salesforce 3 iframes, one inside another, are created!
I managed to get it working by forcing a patch with https://www.npmjs.com/package/patch-package
diff --git a/node_modules/react-color/es/components/common/Saturation.js b/node_modules/react-color/es/components/common/Saturation.js
index 8e2f44c..1749ee8 100644
--- a/node_modules/react-color/es/components/common/Saturation.js
+++ b/node_modules/react-color/es/components/common/Saturation.js
@@ -52,8 +52,14 @@ export var Saturation = function (_ref) {
var container = this.container;
var renderWindow = window;
- while (!renderWindow.document.contains(container) && renderWindow.parent !== renderWindow) {
- renderWindow = renderWindow.parent;
+ var lastRenderWindow = window;
+ try {
+ while (!renderWindow.document.contains(container) && renderWindow.parent !== renderWindow) {
+ lastRenderWindow = renderWindow;
+ renderWindow = renderWindow.parent;
+ }
+ } catch (e) {
+ renderWindow = lastRenderWindow; // inside iframe it throws error... use last accessible
}
return renderWindow;
}
diff --git a/node_modules/react-color/lib/components/common/Saturation.js b/node_modules/react-color/lib/components/common/Saturation.js
index 0a80592..e1bb4d0 100644
--- a/node_modules/react-color/lib/components/common/Saturation.js
+++ b/node_modules/react-color/lib/components/common/Saturation.js
@@ -74,8 +74,14 @@ var Saturation = exports.Saturation = function (_ref) {
var container = this.container;
var renderWindow = window;
- while (!renderWindow.document.contains(container) && renderWindow.parent !== renderWindow) {
- renderWindow = renderWindow.parent;
+ var lastRenderWindow = window;
+ try {
+ while (!renderWindow.document.contains(container) && renderWindow.parent !== renderWindow) {
+ lastRenderWindow = renderWindow;
+ renderWindow = renderWindow.parent;
+ }
+ } catch (e) {
+ renderWindow = lastRenderWindow; // inside iframe it throws error... use last accessible
}
return renderWindow;
}
from react-color.
You are not using @uiw/react-color. You should go to react-color to ask the wrong question.
from react-color.
Just found similar issue that's reported in react-color - casesandberg/react-color#806
from react-color.
Can you give me a reproducible example using codesandbox.io?
from react-color.
Just found similar issue that's reported in react-color - casesandberg/react-color#806
I'll close bug here, bug is already open there :)
from react-color.
Related Issues (20)
- Wheel using HEX instead of HSVA HOT 2
- Wheel shape width/height adaption HOT 2
- onChange 用useCallback 包裹 ,onChange里面无法修改父组件的状态!把useCallback 干掉可以吗? HOT 10
- Disable Alpha for Sketch picker HOT 3
- Shade slider (white color) HOT 1
- Colorful component works incorrectly on mobiles HOT 1
- hex is #00000000 bug
- Direction hue "vertical" HOT 2
- Null/undefined color value HOT 10
- Support hex input with leading # HOT 2
- Typo in Github picker placement enum: "Botton" instead of "Bottom" HOT 1
- Sometimes Wheel don't react to onChange HOT 2
- Change Value for Wheel HOT 7
- Color picking dark color results in jumpy behavior HOT 3
- [color-convert] Circular dependencies error HOT 2
- Direction/angle color issue HOT 1
- Circle with margin HOT 8
- Add type for Hex color HOT 1
- Add eyedropper to Chrome HOT 1
- Wheel cursor disabled HOT 2
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-color.