Skip to content
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

Fix: Permalink editor rtl languages #13919

Merged
merged 2 commits into from
Sep 9, 2019
Merged

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Feb 18, 2019

Description

Fixes: #12729
Improves the permalink editors on RTL languages.
The new design follows the screens shared by @desrosj in #12729.

How has this been tested?

I switched to an RTL language and verified the result I got is the one rendered on the screenshots.

Screenshots

Before:
screenshot 2019-02-18 at 12 56 54

After:
screenshot 2019-02-18 at 12 55 30

Before:
screenshot 2019-02-18 at 12 28 50

After:
screenshot 2019-02-18 at 12 07 12

@@ -9,3 +9,10 @@
.edit-post-post-link__link {
word-wrap: break-word;
}

/* rtl:begin:ignore */
body.rtl .edit-post-post-link__preview-link-container {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we don't rely on body.rtl as these components can be shown anywhere and not only the editor pages. One way of doing this is to rely on the isRTL of the editor settings. But I'd like to understand why the default RTL handling was not working properly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we don't rely on body.rtl as these components can be shown anywhere and not only the editor pages.
True I will update to use a class conditionally added by isRTL.

But I'd like to understand why the default RTL handling was not working properly?

The default handling was working properly the problem we have is that it looks like even on RTL languages the permalink is not RTL so we trying to force LTR on this zone.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we could solve this just by using /* rtl:begin:ignore */ as I assume these styles could apply similarily to both directions right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we could solve this just by using /* rtl:begin:ignore */ as I assume these styles could apply similarily to both directions right?

The problem is that direction rtl is inherited so the direction elements are rendered is changed and we need a rule to overwrite the direction in a specific zone.
I also verified that simply adding an ignore on the zone long-content-fade is used does not produces the ideal result. Probably that's the reason long-content-fade receives a direction parameter.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we force the direction here. Basically what I'm saying is: Can't we just keep these styles you added but remove body.rtl?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Riad, I updated this PR going in the direction you are suggesting, we now don't use body.rtl. Thank you for the feedback 👍

@gziolo gziolo added Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Bug An existing feature does not function as intended [Feature] Permalink The permalink of a post or page and the experience of setting or editing it labels Feb 19, 2019
@gziolo gziolo added this to the 5.2 (Gutenberg) milestone Feb 19, 2019
@youknowriad
Copy link
Contributor

Actually, this still appears broken to me when using RTL languages. I have this:

capture d ecran 2019-02-25 a 9 17 42 am

The URLS should show-up like the following screenshots (taken when using English in the dashboard)

capture d ecran 2019-02-25 a 9 18 12 am

@jorgefilipecosta
Copy link
Member Author

Hi @youknowriad, on the RTL languages I'm getting this:
screenshot 2019-02-25 at 09 30 11
I think that is the expected result. The screenshots you provided look similar to what happens currently on master, maybe there was a caching issue?

@youknowriad
Copy link
Contributor

@jorgefilipecosta you're not using rtl characters in your example, maybe that's related, try some random arabic word in the title/permalink.

@youknowriad
Copy link
Contributor

Also, why your Gutenberg UI don't seem translated?

@swissspidy
Copy link
Member

Also, why your Gutenberg UI don't seem translated?

WordPress plugin language packs have been missing the needed JSON files in the past, but this should be fixed now. Try updating your translations.

@youknowriad
Copy link
Contributor

@jorgefilipecosta I wouldn't expect that result personally. I think the UI should still be reversed (from right to left) but the URL should not, the URL should always be shown from Left to Right.

@swissspidy
Copy link
Member

Some feedback from actual RTL speakers might be beneficial here :-)

@youknowriad
Copy link
Contributor

Well, I am 🤷‍♂️ an RTL speaker

@swissspidy
Copy link
Member

@youknowriad How could I forget, sorry! 🤦‍♂️

@youknowriad
Copy link
Contributor

No worries 😄

@jorgefilipecosta jorgefilipecosta force-pushed the fix/permalink-editor-rtl branch 2 times, most recently from 3f9c8b9 to bccf734 Compare February 27, 2019 15:14
@jorgefilipecosta
Copy link
Member Author

Hi @youknowriad this PR was updated following your suggestion:
screenshot 2019-02-27 at 13 14 29
screenshot 2019-02-27 at 13 14 38

@youknowriad
Copy link
Contributor

From the mockup, the white gradient seems like it's going in the wrong direction.

@jorgefilipecosta
Copy link
Member Author

Hi @youknowriad, I changed the mockup direction:
image

But, to make the gradient work as expected I needed to change the text-align, otherwise, the gradient would always cover part of the link even if the link was small:
screenshot 2019-03-04 at 08 30 15

I'm not sure if this change is something acceptable.

@youknowriad
Copy link
Contributor

@senadir is this something you can help review? It's a bit old but it seemed ready?

@jorgefilipecosta
Copy link
Member Author

I just did a rebase the PR still seems to be valid and review would be helpful :)

Copy link
Contributor

@senadir senadir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took this in a long spin and it works great, ready to merge

@jorgefilipecosta jorgefilipecosta merged commit 276981d into master Sep 9, 2019
@jorgefilipecosta jorgefilipecosta deleted the fix/permalink-editor-rtl branch September 9, 2019 17:59
@youknowriad youknowriad added this to the Gutenberg 6.5 milestone Sep 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Permalink The permalink of a post or page and the experience of setting or editing it Internationalization (i18n) Issues or PRs related to internationalization efforts [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

incorrect display of permalink address in editor
6 participants