Problem/Motivation

There are several issues with RTL alignment of text, mostly with checkbox margins and alignment of elements. Originally discussed in #3315854: Improve the readability of module cards in grid view, where @rkoller kindly supplied most of the text.

Steps to reproduce

Open Project Browser and see that some elements are either misaligned, or needs adjustment of margin or padding. To switch between LTR and RTL, Firefox supports toggling between RTL and LTR alignment of text.

LTR RTL elements comparison

LTR RTL elements comparison

Proposed resolution

Fix the issues below, and if more issues are discovered, add them to the list.

Lists

  • Grid: "List" button is right aligned and should be moved to the left over to the grid button.
  • Grid: Card Download button: Needs more margin but the button has to be moved towards the left card border. The spacing part applies to LTR as well.
  • Categories: Need spacing/margin between label and checkbox. There is a general issue about the checkbox styling #3300262: Adjust the checkbox design for the categories sidebar to the Drupal Design system.
  • Search box: The magnifying glass has to be moved to the left border in the search box.
  • Filter component: The results count needs a padding, it is too close to the border (but that result count will probably be moved out of the filter component #3310896: Improve UI of results count). If you compare the spacing between the results count and the chips the spacing between the two is smaller in LTR than RTL. Also, the spacing between the sort by select and filters button is smaller in LTR than RTL while the filters buttons is missing a spacing to the left border.
  • Filter component: The radio button labels in the expanded filters buttons are on the left instead of the right of the label. Also, spacing needs adjustment.

Project page

  • The details section in the sidebars has quite a few alignment issues.
  • The headlines like features, getting involved... etc are aligned left instead of right.
  • The quote in the feature section is aligned left instead of right.
  • The whole getting the most out of the webform module section, headlines as well as paragraphs is aligned to the left instead of right
  • Meet the project maintainers the images are correct as well its descriptions but the headlines are aligned to the left instead of to the right.

See https://www.drupal.org/files/issues/2022-10-23/webform_ltr.jpg and https://www.drupal.org/files/issues/2022-10-23/webform_rtl.jpg.

Instructional modal

  • The code snippets don't have enough margin or padding at the beginning and too much margin or padding at the end after the clipboard icon.

See https://www.drupal.org/files/issues/2022-10-23/instructional_modal.jpg

Remaining tasks

  • ✅ File an issue about this project
  • ☐ Manual Testing
  • ☐ Code Review
  • ☐ Accessibility Review
  • ☐ Automated tests needed/written?
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ressa created an issue. See original summary.

rkoller’s picture

StatusFileSize
new1.11 MB
new1.11 MB

I've taken a look a one of the project pages as well. i've picked the webform module that it has one of the more extensive body fields (see the two screenshots). a few potential problems i've noticed:

  • The details section in the sidebars has quite a few alignment issues.
  • The headlines like features, getting involved... etc are aligned left instead of right.
  • The quote in the feature section is also aligned left instead of right.
  • The whole getting the most out of the webform module section, headlines as well as paragraphs is aligned to the left instead of right
  • Meet the project maintainers the images are correct as well its descriptions but the headlines are aligned to the left instead of to the right.
ressa’s picture

Title: Fix RTL margins and alignment of elements » Fix RTL margins and alignment of elements in lists and on project page
Issue summary: View changes

Thanks for checking the project page @rkoller, I have added your observations under a new "Project page" heading.

I have been thinking more about creating child issues, and in a related LTR/RTL issue, the solution was not to add text-align: right for RTL, but instead remove text-align: left for LTR.

So dealing with RTL from the "helicopter view" (text-align almost everything right by default) is probably better, resulting in leaner code. So from that perspective, let's maybe keep RTL.issues in one place, as much as possible. What do you think?

rkoller’s picture

Issue summary: View changes
StatusFileSize
new272.15 KB

That is totally up to you. I am not a developer, therefore i am unable to judge which solution would result in the leanest code. Totally trust on your judgment on that end. But also definitely a +1 for creating child issues and trying get the leanest most robust solution. What ever works best.

And did a quick last check and took a look at the instructional modal in case package manager is not installed and or #3312289: Svelte UI for install controllers is not landed yet. the margin at the beginning and at the end of the code snippets is not correct. At the beginning it is too less and at the end after the icon it is too much. Also added the details to the issue summary.

Utkarsh_33 made their first commit to this issue’s fork.

utkarsh_33’s picture

StatusFileSize
new200.26 KB
new228.09 KB

I have tried to address most of the feedbacks regarding the RTL support.Please check and provide feedbacks for more improvements .

utkarsh_33’s picture

Status: Active » Needs review
ressa’s picture

Thanks @Utkarsh_33, great work! It looks to me like many of the issues in the Issue Summary are now fixed.

It would be great if someone who is natively a RTL-reader (such as Arabic, Hebrew or Persian) could try out the patch, and check if everything looks all right in RTL-view.

bnjmnm made their first commit to this issue’s fork.

bnjmnm’s picture

Status: Needs review » Needs work
StatusFileSize
new7.55 KB
new8.59 KB
new39.03 KB

The inline css properties is a great solution! It seems like this could all be addressed in one issue, but if we hit something trickier it's certainly worth moving that to a followup so we can commit all the good improvements here.

On manual review I spotted the following:

  1. Looks like the magnifying glass icon is being moved in a way we don't want with the changes here. This is for LTR and RTL If this isn't happening on your sites I'll dig further into what styles are causing the issue.
  2. The filter dropdown doesn't have quite enough margin against the container in LTR.

  3. On RTL the distance between a radio input and it's label looks doubled or more. It also seemes container of radio+input are close to each other.
utkarsh_33’s picture

Status: Needs work » Needs review
rkoller’s picture

Status: Needs review » Needs work
StatusFileSize
new708.57 KB
new553.98 KB
new1.04 MB

I 've tried to test the merge request a few days ago for the first time but I was unable to apply. But with the latest changes today it possible to apply. thanks! I've then installed the multilingual modules and installed and set hebrew as the administration language (even though it hasn't had much of an effect since most of the strings aren't translated yet).

The three points in #11 still apply. In addition #11.1 does apply for ltr as well:

two project browser main windows in ltr and rtl next to each other
(*on the left a window with english as the administration language (ltr) and on the right with hebrew as the administration language (rtl))

on single project pages on the first look the points in #2 seem also still to apply. the body is left aligned instead of right aligned. same for the details section in the sidebar with its elements (especially the unordered lists looks off)
two single project windows in ltr and rtl next to each other

but on a second look it seems not in general for every single project page cuz i've taken a look at the webforms module i've used as an example in previous comments. there parts of the body (for example the unordered lists) are correctly aligned to the right (see webform.jpg)

utkarsh_33’s picture

Status: Needs work » Needs review

narendraR made their first commit to this issue’s fork.

narendrar’s picture

Status: Needs review » Needs work
StatusFileSize
new157.73 KB
new34.36 KB

Issue 1
Issue 2

Grid: "List" button is right aligned and should be moved to the left over to the grid button.

Still right aligned.

The spacing between the sort by select and filters button is smaller in LTR than RTL while the filters buttons is missing a spacing to the left border.

Spacing needs to be adjusted.

Filter component: The radio button labels in the expanded filters buttons are on the left instead of the right of the label. Also, spacing needs adjustment.

Design not correct in RTL.

The code snippets don't have enough margin or padding at the beginning and too much margin or padding at the end after the clipboard icon.

This is not fixed yet.

utkarsh_33’s picture

Addressed all the feedbacks in #16.

utkarsh_33’s picture

Status: Needs work » Needs review
srishtiiee’s picture

Status: Needs review » Needs work
StatusFileSize
new529.48 KB

All the feedback is addressed and the changes look great. I could find only one issue with the list view. The security icon is not aligned with the other elements and spacing between the two icons in RTL is not as much as in LTR.

bnjmnm’s picture

Component: User experience » Code
bnjmnm’s picture

Status: Needs work » Needs review
bnjmnm’s picture

StatusFileSize
new475.59 KB
new175.4 KB
new498.31 KB

MR as of right now:

srishtiiee’s picture

Status: Needs review » Needs work
StatusFileSize
new286.17 KB
new220.1 KB

Tested the MR locally and I'm seeing some of the alignments different than the screenshots in #22.
1. The filters are going out of the box on the right.

2. The "Add and install" buttons are not aligned with the security icon and the "Installed" button.

bnjmnm’s picture

Status: Needs work » Needs review

Forgot to push the changes to the MR that result in the successful screenshots from #22. They are pushed now

narendrar’s picture

Status: Needs review » Needs work
StatusFileSize
new402.7 KB

Found 2 design issues in attached screenshot, circled in red.
Issue

utkarsh_33’s picture

Addressed feedbacks from #25.

bnjmnm’s picture

Status: Needs work » Needs review
narendrar’s picture

Status: Needs review » Needs work
StatusFileSize
new190.09 KB

Everything looks great except 2 points:

  1. Grid and List button should be left aligned
  2. Space between Sort by and filter is more

Issue

bnjmnm’s picture

Status: Needs work » Needs review
narendrar’s picture

Status: Needs review » Reviewed & tested by the community

All points addressed. Marking as RTBC.

tim.plunkett’s picture

Issue tags: +core-mvp
bnjmnm’s picture

Status: Reviewed & tested by the community » Fixed

This seems to provide only improvements without regressions and if we missed anything we can take care of it in followups. This should get in before the pending CSS cleanups make it a nightmare to rebase. Merging.

  • bnjmnm committed 9ca008c2 on 1.0.x authored by Utkarsh_33
    Issue #3316998 by Utkarsh_33, bnjmnm, narendraR, srishtiiee, rkoller,...
bnjmnm’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.