-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add WordPress Playground Block #2264
Add WordPress Playground Block #2264
Conversation
@adamziel thank you for creating this PR I'm going to put out a call for Training team members to help test/review this PR. |
Note to reviewers, one of the other items to consider is accessibility, so it would also be ideal if the new block is tested for accessibility using the axeDevTools browser extension |
I love the direction. Can we check in with Accessibility team as well? |
@courtneyr-dev in the past, I've checked with members of the Accessibility team, and they've confirmed that using the axeDevTools browser extension is a good process to follow. If you're aware of any other tools we can use to test this for Accessibility, please link them here, and we can add them to the testing process. |
axe doesn't cover everything. I'm happy to test if you let me know where I can test it. (I tried to download the plugin and install it on a fresh install with no luck - it never came up when looking for blocks.) |
If Playground renders in an iFrame, it will already be disadvantaged for accessibility. I would not consider an approve on this until there was an option to open in a new window, non-iFrame option. Thanks. |
@bbertucc are you comfortable testing it using the Learn WordPress local development environment? (details in the readme). Alternatively, you can download the zip file manually from the plugin repository. |
@alexstine thank you, that's useful! An "open in a new window" option can be added with a relative ease 👍
@bbertucc Oh no! Thank you for reporting the problem, I'll double-check that. Is there any chance it's because the plugin doesn't provide any search keywords and the block is difficult to find? Or is it just not there, even if you type "WordPress Playground" verbatim? Meanwhile, are you able to test using the Learn WordPress local dev env like @jonathanbossenger suggested? |
@jonathanbossenger - i'll spinup a local environment. sounds like @adamziel still has a bit more work to do, so I'll check it out after the plugin has been updated. |
@adamziel I think the problem is also that the original version of this block was named "Interactive Playground Block" and as such, that's what the slug is. As you might know, you cannot unfortunately change the plugin slug. When searching for "Interactive Playground Block", the block does appear in search results. |
That could be it @jonathanbossenger! I just installed the plugin on a Local site and the block did come up. Would you mind trying again @bbertucc? And, in the meantime, we'll explore the open in a new window mode. |
@alexstine I've explored an iframe-less "Open in a new window" feature, and I ran into two technical blockers. We can't open the same site in a new window. We can only open a new site with the same initial configuration.The iframed WordPress site cannot be seamlessly opened in a new window. The embedded Playground only exists in the context of the current domain because of the Privacy Sandbox. We could open new a site with the same initial configuration as the iframed site. To illustrate: Say I write a theme customization tutorial for a site that a custom theme, say That doesn't seem like a deal-breaker as the block could clearly communicate that limitation, e.g. by naming the button "start over in a new window". Here's a larger challenge, though. A code editor would be unreliable in an iframe-less setup.Imagine a technical tutorial that teaches people how to write their first plugin. We need a code editor and a WordPress preview side by side. How would it work without iframing the WordPress site, though? Clicking on any link would reload the entire page, including the code editor. Also, the code editor would effectively be rendered as a part of the WordPress site within the theme and it would be affected by WordPress styles, plugins, hooks. Furthermore, if the student saves a plugin with a syntax error, the WordPress site won't reload which means there will be no way to fix that error from the code editor. I can't think of a good way of resolving the problems associated with modifying a state of the system from inside that system. Iframes provide a degree of separation required to debug fatal errors. Let's find an accessible way forwardWhat are three most important specific accessibility issues related to iframes? Is there something Playground can do to resolve them? If not, let's discuss alternative paths forward. The interactive iframe-based materials would benefit millions of future learners and I'd argue there's value in creating them even if they wouldn't be fully accessible. Perhaps every iframe-based tutorial could also have a static, iframe-less version with the same code examples and instructions intended for use in a local environment with your own WordPress installation and a code editor? |
@adamziel iFrames are simply just challenging for accessibility. They are somewhat better on Windows today but Mac Voiceover uses a much different interaction model. What worries me about this is having an iFrame inside an iFrame since the Gutenberg editor canvas is now an iFrame. Sites like CodePen have been really hard for me to use and only recently became an option. For most of my coding stuff, I'd add it to a GitHub Gist. I guess I'll try to revive my local environment and test the plugin. The other thing you need to keep in mind is iFrames don't exactly care where they are placed so if you have important content after the iFrame such as instructions on what to do, I won't get that information because I'll first have to navigate beyond the iFrame. That is the biggest reason I don't want to see this on Learn right now, I am not confident that there is enough accessibility checking in place to say "any content following the iFrame must have a heading for easily skipping passed the iFrame." Trying to enforce this would be tricky. Thanks. |
@adamziel - the block came up this time, but the error popped up in my console: |
@alexstine thank you for explaining!
Is the recent change related to Voiceover updates, or CodePen updates?
I'm updating the plugin today and will post a testing link here that will open the plugin in Playground. It would mean even more iframes, though, but it wouldn't require setting up a dev env. Also, about the iframes I'm noodling on the following ideas:
Would either of these be helpful? |
@adamziel CodePen changes. It used to crash whatever browser I used. Still hard to navigate but somewhat better today. I think as long as there is a way to skip the iFrame and only load the iFrame when ready, that should be enough. New window option would not be required. Thanks. |
@bbertucc oh no, it seems like the plugin doesn't work in Safari. I created an issue to track this and will follow up shortly. In the meantime, would you mind trying it out on Chrome? Note the plugin has a live preview link here: https://wordpress.org/plugins/interactive-code-block/advanced/ |
@jonathanbossenger @bbertucc @alexstine I've fixed a number of issues in the block and Playground. The latest version Edit: It seems like these Playground URLs were not posted correctly. I'm figuring out a solution now.
And, here's the list of issues fixed thanks to your feedback so far: |
@adamziel Looks like those are the same 2 links. Thanks. |
@alexstine It seems like these Playground URLs were not posted correctly, there's something GitHub does with formatting it seems. I'm figuring out a solution to provide working URLs. |
Alright, sorry for the kerfuffle. I've ended up shipping a new Playground feature to post these links here: Here are working links: |
@adamziel Are you still working on the links to skip the Playground embed? |
@alexstine, yes, that feature isn't a part of the block yet. I expect to ship it next week. |
Hi all, GeneralAlmost everything works fine: I was able to add the block and interact with all the options and features available from the sidebar. The only problem I had was going from AccessibilityI also tested both links with Axe (the extension isn't supported on Safari)
Hope it helps :-) |
…und Iframe (#183) This PR updates the wordpress-playground-block to only load Playground after an Activate button has been clicked. ## Why? IFrames can create difficulty for those using Screen Readers. See: [#](WordPress/Learn#2264 (comment)), [#](WordPress/Learn#2264 (comment)) Requiring user action to load Playground will help avoid distracting screen readers with auto-loading iframes. As a bonus, it would also stop the block from automatically consuming network bandwidth to download Playground assets, even if Playground will not be used. ## How? <!-- How is your PR addressing the issue at hand? What are the implementation details? --> This button must be clicked before the code editor and Playground load, so the iframe no longer loads immediately. ## Questions Would it be better to just gate the iframe with an Activate button? Perhaps that doesn't make sense because of the expected interaction with the code editor, but I think it _might_ look better than a single activation button in the middle of a large block like this one.
@ironnysh @alexstine I just released a new version of the plugin where all the reported issues are fixed: Post with the WordPress Playground block
@alexstine the plugin now displays a button to activate the live preview. Only after that button is clicked, the iframe is displayed. Does that make the page easier to navigate?
@ironnysh Good find! I went ahead and removed the ability to change the mode. While useful, it isn't a crucial feature and doesn't have to block this PR.
Thank you for reporting! I just released a new version |
@alexstine would you be able to confirm this recent change made the block more usable? |
@adamziel I don't know where to test it, I don't see it on the links you provided above. |
@alexstine at the moment, the way I am testing this is via the Learn WordPress local development environment. But I know you've had some problems with the local environment in the past. This PR only adds the plugin to the list of available plugins for Learn WordPress but does not implement the block anywhere, unless it's physically added by a content creator. How would you feel about provisionally merging this PR, then I'll add a single instance of this block to a test lesson on Learn WordPress. We can create this lesson in preview mode, and share the preview URL in a separate GitHub issue in this repository for testing and feedback. That way any interested parties can test out the block on Learn WordPress, but without it being in use anywhere else on the site. If we ultimately decide it's not fit for use, it's a minor task to revert the PR, as it's just two lines in the composer.json file. |
@jonathanbossenger Sounds good. |
Perfect, thanks @alexstine and everyone else involved here. @pkevan when you have a moment, could I ask you to merge and deploy this change, so we can start testing the playground block on Learn WordPress? I have created a GitHub issue where we can all test this together once it's merged. Once this PR is merged, I will update that issue with a link to the test lesson. |
@adamwoodnz would you be able to assist getting this PR merge tested and deployed? |
I mentioned this elsewhere but I don't think this will work on wp.org as-is since we don't have build capabilities on deploy, so it would need to be added as a plugin, which might need consideration as it would be enabled network-wide. |
@pkevan ah, bummer! What kind of consideration would be required? |
For completeness, this was added as a plugin from https://plugins.svn.wordpress.org/interactive-code-block/tags/0.2.1/ |
Description
This PR adds the WordPress Playground Block to Composer dependencies.
The block enables embedding WordPress Playground in posts and pages – both as:
Motivation
The Playground block would unlock a next-level interactive learning experience on learn.wp.org. Tutorials for testers, designers, and developers could include not just screenshots and videos, but actual live WordPress instances opened directly on the relevant page, e.g. the Site editor. Developers could learn to build plugins by interacting with a live code editor where a simple plugin is already created for them, and they're encouraged to customize it.
How does it work?
The WordPress site displayed in the Playground block can be customized using the block toolbar and block inspector controls. The changes made directly in the embedded WordPress are not saved yet. The most powerful customization tool available in the block is the custom Blueprint inspector control – with a single JSON file, you can prepare any WordPress site at all.
Next steps
I would love to hear your thoughts and find out whether the block has the features most important for you or is it missing anything crucial.
cc @westnz @jonathanbossenger