-
Notifications
You must be signed in to change notification settings - Fork 802
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
[Earn] Remove jQuery dependency from Thickbox #28318
base: trunk
Are you sure you want to change the base?
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run
to get started. More details: p9dueE-5Nn-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.
projects/plugins/jetpack/extensions/shared/memberships-modal.js
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/extensions/shared/memberships-modal.js
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/extensions/shared/memberships-modal.js
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/extensions/shared/memberships-modal.js
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/extensions/shared/memberships-modal.js
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/extensions/shared/memberships-modal.js
Outdated
Show resolved
Hide resolved
|
||
// This line has to come after the Thickbox has opened otherwise Firefox doesn't scroll to the top. | ||
window.scrollTo( 0, 0 ); | ||
} ); | ||
} | ||
|
||
export const initializeMembershipButtons = selector => { | ||
const membershipButtons = Array.prototype.slice.call( document.querySelectorAll( selector ) ); | ||
const membershipButtons = [ ...document.querySelectorAll( selector ) ]; |
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.
Check if this code is transpiled
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 as above
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 as above. The fact that your browser supports it does not mean every will
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 don't know. I'll change it.
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.
Done
projects/plugins/jetpack/modules/memberships/class-jetpack-memberships.php
Show resolved
Hide resolved
Also needs rebasing and proper labels and stuff |
49774f9
to
5975152
Compare
You need to remove it as we have one displayed in https://github.com/Automattic/jetpack/blob/trunk/projects/plugins/jetpack/extensions/shared/memberships.scss#L9 |
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.
Any chance you could add some testing instructions, so I'm sure not to miss anything when I test this?
projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php
Outdated
Show resolved
Hide resolved
projects/plugins/jetpack/extensions/shared/memberships-modal.js
Outdated
Show resolved
Hide resolved
@@ -37,3 +37,151 @@ | |||
BODY.modal-open { | |||
overflow: hidden; | |||
} | |||
|
|||
/* ----------------------------------------------------------------------------------------------------------------*/ |
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.
Should this CSS be moved to a central location, where other extensions using the thickbox can use it too?
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.
Not sure we want to share this library just yet: this is a really down-sized (in term of feature) version of thickbox, and there is no documentation. Maybe it should stay with this extension...
But we can definitely start a talk about re-using and re-implementing the rest of the functionnalities if JP is eager to use this...
'beforeend', | ||
"<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + | ||
caption + | ||
"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div></div><iframe frameborder='0' hspace='0' src='" + |
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.
It would be nice if those strings were translated. Since you placed the lib in the extensions
dir, it gets transpiled so you should be able to either:
- Import
__
from @wordpress/i18n` and translate in place. I would not recommend this since it would bring a lot of extra dependencies on a file that we also load on the frontend. - Pass those translations from php to js with
wp_localize_script
. We do not have a specific script handle to attach it to at the moment though.
This all makes me wonder if that new lib should be handled like a real lib, like some of the ones we have in projects/plugins/jetpack/_inc
. We would then register it as a new script (jetpack-thickbox
) in Jetpack::register_assets()
, and pass the translations there. We could then add the script as a dependency when needed.
To give you a better idea of what I mean, I pushed 79d3e76 in a test branch. Let me know what you think about the idea.
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.
That gos with my comment here.
I do like the idea, but maybe we should wrap this PR first and then extend its functionality and share it for other extensions after talking with the team?
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 opened the discussion here:
p9dueE-6Cp-p2
To clarify my thoughts on this: I am against creating a drop-in full-featured replacement for thickbox and especially creating a shared library because:
We can take Fab's work and start the process of creating a shared thickbox replacement as a separate piece of work. However this is not something we can do in the timeline that we have |
@artpi : Regarding the long term solution, I want to note that most #28626 tries to keep tabs on what libraries are being used on frontend JS, to avoid the issue spreading further. As such, what we really need to replace thickbox is a frontend-safe modal library. Is there anything like that currently planned for Gutenberg? |
I will page @mtias as he is the instigator for this project and knows best |
I'm going to go and close my PR then 😆. |
Matias answered this in p9dueE-6Cp-p2#comment-9217 with a link about using this: https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/navigation/view-modal.js |
@n3f that's the leanest implementation we have on the front-end. I'd also be curious if we can use |
I updated this PR description and refreshed it with latest trunk so it can be tested, but I'm still not sure on the current status for this. Based on the different discussions on P2 and above, should we go with an implementation of view.modal.js or |
This PR has been marked as stale. This happened because:
No further action is needed. But it's worth checking if this PR has clear testing instructions, is it up to date with trunk, and it is still valid. Feel free to close this PR if you think it's not valid anymore — if you do, please add a brief explanation. |
Fixes Automattic/wp-calypso#71048
See #32237
Proposed changes:
Jetpack product discussion
p9dueE-6Cp-p2
Does this pull request change what data or activity we track or use?
Testing instructions: