-
Notifications
You must be signed in to change notification settings - Fork 564
Fix: Resolve spotlight flickering issue on elements with spotlightClicks enabled #1153
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
Open
maoryadin
wants to merge
11
commits into
gilbarbara:main
Choose a base branch
from
maoryadin:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactor `hideSpotlight` function in `src/components/Overlay.tsx`. * Remove `continuous` from the destructured props. * Define `hiddenLifecycles` array with `LIFECYCLE.BEACON`, `LIFECYCLE.COMPLETE`, and `LIFECYCLE.ERROR`. * Return true if `disableOverlay` is true or if `lifecycle` is in `hiddenLifecycles` array. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/maoryadin/react-joyride?shareId=XXXX-XXXX-XXXX-XXXX).
Refactor hideSpotlight function
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Update `hideSpotlight` function and `componentWillUnmount` method in `src/components/Overlay.tsx`. * Add `continuous` to the destructured props in the `hideSpotlight` function. * Update the `hiddenLifecycles` array to include `LIFECYCLE.BEACON`, `LIFECYCLE.COMPLETE`, and `LIFECYCLE.ERROR`. * Update the `shouldHide` variable to account for the `continuous` property. * Update the `hideSpotlight` function to return `shouldHide`. * Add state reset for `mouseOverSpotlight` to `componentWillUnmount` method. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/maoryadin/react-joyride?shareId=XXXX-XXXX-XXXX-XXXX).
Fix overlay spotlight hiding logic
…lifecycle changes in componentDidUpdate Refactor `componentDidUpdate` method in `src/components/Overlay.tsx` to handle `spotlightClicks`, `disableOverlay`, and `lifecycle` changes. * Add logic to remove `mousemove` event listener and reset `mouseOverSpotlight` state when `spotlightClicks` or `lifecycle` changes. * Add logic to add `mousemove` event listener when `spotlightClicks` is true and `lifecycle` is `LIFECYCLE.TOOLTIP`. * Remove redundant `mousemove` event listener removal logic. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/maoryadin/react-joyride?shareId=XXXX-XXXX-XXXX-XXXX).
Fix overlay component to handle spotlightClicks, disableOverlay, and lifecycle changes in componentDidUpdate
Hey @maoryadin Did you try the pre-release version? npm i react-joyride@next Do you still have the problem with it? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR refactors the hideSpotlight method to resolve a flickering issue when interacting with elements with spotlightClicks enabled.
Key Changes:
• Optimized hideSpotlight logic:
Simplified and memoized the hidden lifecycle conditions by moving hiddenLifecycles to a constant outside the method.
• Bug Fix:
Previously, the spotlight would briefly flicker when clicking elements with spotlightClicks enabled due to unnecessary re-evaluations of the overlay condition. The updated logic ensures consistent behavior by streamlining the condition check.