-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Tour Kit: Update spotlight effect, other fixes/cleanup #58854
Conversation
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-24285 |
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
useEffect( () => { | ||
/* | ||
* Fixes issue with Popper misplacing the instance on mount | ||
* See: https://stackoverflow.com/questions/65585859/react-popper-incorrect-position-on-mount | ||
*/ | ||
update && update(); | ||
setTimeout( () => setTourReady( true ) ); | ||
}, [ update ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a test with the Welcome Tour and it seems that the "flickering" is still there: https://d.pr/v/24r3Xb (look when you arrive at the third point)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Yep, see it.
I think I've found a better fix 🤞 Take another look? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noticing this again while testing. looking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, now it seems to be working, well done!
const tourContainerRef = useRef( null ); | ||
const popperElementRef = useRef( null ); | ||
const [ popperElement, sePopperElement ] = useState< HTMLElement | null >( null ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommended way for setting the popper element (useState
triggers a re-render): https://popper.js.org/react-popper/v2/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good to me, great job! 💪
Left a comment for a problem with setTourReady
const tourContainerRef = useRef( null ); | ||
const popperElementRef = useRef( null ); | ||
const [ popperElement, sePopperElement ] = useState< HTMLElement | null >( null ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one 💯
useEffect( () => { | ||
/* | ||
* Fixes issue with Popper misplacing the instance on mount | ||
* See: https://stackoverflow.com/questions/65585859/react-popper-incorrect-position-on-mount | ||
*/ | ||
update && update(); | ||
setTimeout( () => setTourReady( true ) ); | ||
}, [ update ] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a test with the Welcome Tour and it seems that the "flickering" is still there: https://d.pr/v/24r3Xb (look when you arrive at the third point)
This PR modifies the release build for editing-toolkit To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-mMA-p2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! After tests pass =>
8369926
to
ab099dc
Compare
ab099dc
to
9212375
Compare
9212375
to
51323f6
Compare
const clipRepositionProps = referenceElement | ||
? { | ||
style: popperStyles?.popper, | ||
style: { | ||
...( clipDimensions && clipDimensions ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need the clipDimensions &&
check or can we just do...clipDimensions
? ...null
should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tyxla. Added follow-up issue. 🙇
(we are tracking in internal PT)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Christos 🙌
style: { | ||
...( clipDimensions && clipDimensions ), | ||
...popperStyles?.popper, | ||
...( styles && styles ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for styles
as clipDimensions
above.
Changes proposed in this Pull Request
Media
Default spotlight:
Customized for Welcome Tour (fixed-size spotlight, some border radius):
Testing instructions
yarn dev --sync
fromapps/editing-toolkit
to sync the welcome tour to the sandboxyarn run tour-kit:storybook:start
in another tab for Storybook demos?welcome-tour-next
Closes #58642, #58748
Related to #58644