-
Notifications
You must be signed in to change notification settings - Fork 4.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
Site Editor: Make resizable frame compatible with RTL languages #65545
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +47 B (0%) Total Size: 1.77 MB
ℹ️ View Unchanged
|
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 to see fixes before an issue is even reported. It’ll be like it never happened 😉 but then again I didn’t search for an issue—maybe there is one.
The keyboard resizing works just fine. It happens that I tried dragging and the axis is flipped.
resizable-frame-rtl-drag.mp4
That may as well be addressed here too. Here’s a change I tried that seemed to be the minimal way to get it working as expected:
diff --git a/packages/edit-site/src/components/resizable-frame/index.js b/packages/edit-site/src/components/resizable-frame/index.js
index 0585a3182d..d90aa98601 100644
--- a/packages/edit-site/src/components/resizable-frame/index.js
+++ b/packages/edit-site/src/components/resizable-frame/index.js
@@ -253,10 +253,11 @@ function ResizableFrame( {
size={ frameSize }
enable={ {
top: false,
- right: false,
bottom: false,
// Resizing will be disabled until the editor content is loaded.
- left: isReady,
+ ...( isRTL()
+ ? { right: isReady, left: false }
+ : { left: isReady, right: false } ),
topRight: false,
bottomRight: false,
bottomLeft: false,
@@ -276,7 +277,7 @@ function ResizableFrame( {
onMouseOver={ () => setShouldShowHandle( true ) }
onMouseOut={ () => setShouldShowHandle( false ) }
handleComponent={ {
- left: canvasMode === 'view' && (
+ [ isRTL() ? 'right' : 'left' ]: canvasMode === 'view' && (
<>
<Tooltip text={ __( 'Drag to resize' ) }>
{ /* Disable reason: role="separator" does in fact support aria-valuenow */ }
Co-authored-by: Mitchell Austin <[email protected]>
Good catch! I fixed it using the code you suggested. |
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 for the update! Retested and everything works as expected.
I assume the e2e test failures on the latest commits were errant.
Thanks for the review! Regarding the E2E test failure, the cause is being explored here: https://wordpress.slack.com/archives/C02QB2JS7/p1727152145938689 I would like to merge this once this issue is resolved. |
What?
This PR ensures that the resize handles in the site editor are positioned correctly in RTL languages.
How?
I first considered replacing
left
withinset-inline-start
, which is a logical property, butframer-motion
doesn't seem to support this property: motiondivision/motion#1989Therefore, I switched between
left
andright
depending on the language direction.Testing Instructions
Screenshots or screencast
Before
After