welpo / tabi

A modern Zola theme with search, multilingual support, optional JavaScript, a perfect Lighthouse score, and a focus on accessibility.

Home Page:https://welpo.github.io/tabi/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Arrow direction after "Read More" button is incorrect for RTL languages

TheAwiteb opened this issue · comments

Bug Report

The arrow after the "Read More" button is in incorrect direction for RTL languages. It should be pointing to the left instead of right.

Current behavior

image

Expected behavior

image

Also "show changes" and "all_posts" arrows, I'll update it also in the linked PR

image
image

Hi!

How do you plan on fixing this? The macro would come in handy now 🙃

How do you plan on fixing this? The macro would come in handy now 🙃

What do you think about {% if lang in rtl_languages %} ⟵ {% else %} ⟶ {% endif %}?

Or maybe macro like this, is looks better, will help us to do every thing in clean way

do_something::do_something(ltr="⟶", rtl="⟵")

Please suggest a name for the macro :)

{% if lang in rtl_languages %} ⟵ {% else %} ⟶ {% endif %}

That won't work outside base.html, where we define rtl_languages; variables aren't inherited.

Here's something I just learnt about: you can use CSS to target styling based on the directionality of the text. This means we can do:

:dir(rtl) .arrow {
    display: inline-block;
    transform: rotate(180deg);
}

To flip all arrows with the arrow class. So all we need to do is:

  1. Add the arrow class to all arrows, like so:
<a href="{{ get_url(path="blog", lang=lang) }}/">{{ macros_translate::translate(key="all_posts", default="All posts", language_strings=language_strings) }}&nbsp;<span class="arrow">⟶</span></a>
  1. Add the CSS to _misc.scss:
:dir(rtl) .arrow {
    display: inline-block;
    transform: rotate(180deg);
}

This avoids creating the macro. We might regret it later if we need to change something else (who knows?), but I think this is a clean implementation for flipping the arrows.

To find the arrows (they are in different files), you can do a global search for these elements:

I think that's all the arrows on tabi.

Do you want to do the PR yourself? I can do it. Or we can do half and half :)

I think that's all the arrows on tabi.

There is also the "See Changes" arrow

Do you want to do the PR yourself?

Yes I want

There is also the "See Changes" arrow

True! Good catch.

Yes I want

Awesome, thanks! Happy to review when it's ready.