You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a web app that uses multiple Rnd elements at once to replicate a desktop experience - multiple draggable icons, and draggable + resizable 'windows'. Clicking on windows that are 'in the background' brings them to the forefront by tracking the 'highest zIndex' and adding to that. However, sometimes, when an element in already in the foreground, clicking on it (and thus firing the onDragStart and onDragEnd events in the Rnd element) causes the zIndex to momentarily switch to the same value as an element 'lower' on the screen. Through the React state/prop tree, new zIndex values haven't been passed down to any elements, but the react-draggable div's inline styles are changing. After digging into the source a bit, I'm finding it's caused by line 216 here: https://github.com/bokuweb/react-rnd/blob/master/src/index.js
<div style={Object.assign(boxStyle, { zIndex })}>
I was able to solve this problem by just inlining the whole object instead of using Object.assign - I didn't have time to delve further to figure out if this is the right way to go about it, if I find time at some point I'll try to submit a pull request, but if someone wants to check this out, feel free.
The text was updated successfully, but these errors were encountered:
I'm building a web app that uses multiple Rnd elements at once to replicate a desktop experience - multiple draggable icons, and draggable + resizable 'windows'. Clicking on windows that are 'in the background' brings them to the forefront by tracking the 'highest zIndex' and adding to that. However, sometimes, when an element in already in the foreground, clicking on it (and thus firing the onDragStart and onDragEnd events in the Rnd element) causes the zIndex to momentarily switch to the same value as an element 'lower' on the screen. Through the React state/prop tree, new zIndex values haven't been passed down to any elements, but the react-draggable div's inline styles are changing. After digging into the source a bit, I'm finding it's caused by line 216 here:
https://github.com/bokuweb/react-rnd/blob/master/src/index.js
<div style={Object.assign(boxStyle, { zIndex })}>
I was able to solve this problem by just inlining the whole object instead of using Object.assign - I didn't have time to delve further to figure out if this is the right way to go about it, if I find time at some point I'll try to submit a pull request, but if someone wants to check this out, feel free.
The text was updated successfully, but these errors were encountered: