Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-resizable-panels Injects Style Element That Breaks WalkMe Flow #449

Open
virusxd521 opened this issue Jan 24, 2025 · 0 comments
Open

Comments

@virusxd521
Copy link

In my application, I am using WalkMe alongside react-resizable-panels. However, I’ve encountered an issue where react-resizable-panels injects a <style> element into the DOM through the utility functions in its codebase. This behavior disrupts the flow of my application, specifically affecting WalkMe's functionality.

The problem originates in the setGlobalCursorStyle function within react-resizable-panels, where a <style> tag is dynamically created and appended to the . This tag sets a global cursor style (*{cursor: ${style}!important;}), which is interfering with other elements on the page.

Code Reference

The issue lies in the following utility:

cursor.ts
packages/react-resizable-panels/src/utils/cursor.ts

export function setGlobalCursorStyle(
  state: CursorState,
  constraintFlags: number
) {
  if (!enabled) {
    return;
  }

  const style = getCursorStyle(state, constraintFlags);

  if (currentCursorStyle === style) {
    return;
  }

  currentCursorStyle = style;

  if (styleElement === null) {
    styleElement = document.createElement("style");

    const nonce = getNonce();
    if (nonce) {
      styleElement.setAttribute("nonce", nonce);
    }

    document.head.appendChild(styleElement);
  }

  styleElement.innerHTML = `*{cursor: ${style}!important;}`;
}

Steps to Reproduce

Use react-resizable-panels in an application that also integrates WalkMe.
Interact with react-resizable-panels to trigger the injection of the <style> element.
Observe that the injected styles interfere with WalkMe's DOM flow and functionality.

Expected Behavior

react-resizable-panels should avoid globally injecting styles or provide a way to disable this behavior to prevent conflicts with other libraries like WalkMe.

Additional Notes

If there is an existing way to prevent this issue (e.g., disabling the global cursor styles or using a workaround), please advise. Otherwise, a fix or an enhancement to provide better control over this behavior would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant