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 patterns list #5157
Add patterns list #5157
Conversation
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 good and works well!
Tested on WordPress 5.9, with the code mentioned in the description added using the Code Snippets plugin.
I'm not 100% sure if this is expected, but when testing it here, if I click to close the modal, the post content is reverted AGAIN to the original content that Sensei uses. Is this a known issue too, @renatho?
By the way, I was really worried because I first tested this PR on WP 5.7, which doesn't support patterns, and the whole WordPress editor crashed out of nowhere. But that was my mistake, in the end. On WP 5.9 it works perfectly. =)
const accessibleClick = ( fn ) => ( { | ||
onClick: fn, | ||
onKeyUp: ( e ) => { | ||
if ( [ ENTER, SPACE ].includes( e.keyCode ) ) { | ||
fn( e ); | ||
} | ||
}, | ||
} ); |
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.
Really nice touch of accessibility here! Wow! :D
Yeah! It's expected for now because it'll be implemented as part of this issue. When the user click on a pattern, it will replace the texts, and close the modal. I just added that feature while clicking on the patterns for now to illustrate part of the future behavior. 😉
haha.. Yeah! It will support WP 5.8+ |
Part of #5130
Changes proposed in this Pull Request
Testing instructions
Add the following code to your site to have some Sensei patterns:
See the code
Create a new course or lesson and see the modal.
Click in the patterns, and check it being applied to the page (notice that it still doesn't close the wizard process, since we need to tweak the title and description). It's part of another issue.
Screenshot / Video
Screen.Recording.2022-05-19.at.18.46.41.mov