website icon indicating copy to clipboard operation
website copied to clipboard

[ar] Adapt navbar to support RTL langs

Open mboukhalfa opened this issue 1 year ago • 18 comments

This PR use bootstrap class only that support RTL to style the navbar. Previously navbar used ml-md-auto class which does not support RTL and also absolute position for the logo which does not automatically support switching to RTL. This PR adapt the navbar styling to automatically support RTL direction

Fix: https://github.com/kubernetes/website/issues/45077

Inspired from example 3 in https://www.codeply.com/go/qhaBrcWp3v

Simplified example here : https://www.codeply.com/p/bNdMgLE0A5

mboukhalfa avatar Apr 28 '24 09:04 mboukhalfa

Hi @mboukhalfa. I noticed this PR contains some changes I believe you intended for https://github.com/kubernetes/website/pull/46043. Will you please rebase and post some screenshot previews?

adowair avatar Apr 28 '24 10:04 adowair

Hi @mboukhalfa. I noticed this PR contains some changes I believe you intended for #46043. Will you please rebase and post some screenshot previews?

I was expecting to get preview with netlify but not sure why I am not getting this ! I added the other changes so the build succeed I will rebased once merged

mboukhalfa avatar Apr 28 '24 12:04 mboukhalfa

Thanks @mboukhalfa! I am not an HTML expert, but I noticed the language switcher could render better:

Screenshot 2024-04-28 at 3 21 16 PM

Quite an important effort, just wanted to point out this too. Otherwise the navbar itself looks good!

adowair avatar Apr 28 '24 12:04 adowair

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign nate-double-u for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Apr 28 '24 12:04 k8s-ci-robot

Thanks @mboukhalfa! I am not an HTML expert, but I noticed the language switcher could render better:

Screenshot 2024-04-28 at 3 21 16 PM

Quite an important effort, just wanted to point out this too. Otherwise the navbar itself looks good!

yeah there is still two small improvements need the logo size and vertical position slightly changed and the languages drop menu you showed ! I want to get feedback first about this changes in bootsrap classes then we can fix those two

mboukhalfa avatar Apr 28 '24 12:04 mboukhalfa

This PR is just to preview the changes and see the results with RTL lang (ar) the CSS changes will directly target the main branch once satisfied

mboukhalfa avatar Apr 28 '24 12:04 mboukhalfa

/hold

mboukhalfa avatar Apr 28 '24 12:04 mboukhalfa

/remove-language de en es fr hi id it ja ko pl pt ru uk vi zh /remove-area blog release-eng /remove-sig release

Okabe-Junya avatar Apr 29 '24 18:04 Okabe-Junya

/area web-development /area localization

sftim avatar Apr 30 '24 12:04 sftim

I'd prefer to pass the dir for the HTML based on the text direction property of each language. Then it should work much better.

This will need a change within layouts, unless Docsy has support(?)

sftim avatar Apr 30 '24 12:04 sftim

I'd prefer to pass the dir for the HTML based on the text direction property of each language. Then it should work much better.

This will need a change within layouts, unless Docsy has support(?)

The problem is supposing that we have the correct dir ! So my understanding for this issue now is if we have en element with ml-md-auto even when the dir="rtl" it will not switch to the other direction as expected check : https://github.com/twbs/bootstrap/issues/22780

mboukhalfa avatar Apr 30 '24 12:04 mboukhalfa

Let's build on that. Can we make the customisations only apply using the cascade when dir is rtl? (We can pair you up with someone who knows SCSS to help make that happen).

sftim avatar Apr 30 '24 12:04 sftim

Let's build on that. Can we make the customisations only apply using the cascade when dir is rtl? (We can pair you up with someone who knows SCSS to help make that happen).

I appreciate the offer to collaborate. It would be beneficial to team up with someone skilled in Kubernetes custom CSS. My intention is to implement a generic solution that seamlessly accommodates any text direction. Introducing customizations exclusively for right-to-left (RTL) scenarios could complicate our styling process unnecessarily.

It's worth noting that we're concurrently progressing with the migration to newer Docsy https://github.com/google/docsy/issues/1442. Currently, our setup involves custom styling and local old Bootstrap alongside the legacy Docsy, creating complexity. Moreover, our current navbar styling lacks automatic RTL support, adding another layer of intricacy.

Let's ensure our efforts align with the overarching roadmap and streamline our approach for long-term sustainability.

mboukhalfa avatar Apr 30 '24 12:04 mboukhalfa

I'm thinking about this as a technical lead for SIG Docs, and I'm keen to either:

  • implement the RTL tweaks for the nav bar using SCSS / CSS only (using a selector based on the dir) attribute
  • make any layout tweaks conditional on direction

One reason why: when people see that the changes are conditional on direction, any reviewer looking a future change in the same area is likely to take that into account. The reviewer might check for the impact on RTL language layouts, or ask a localization team (for a language written right to left) to confirm all looks well.

sftim avatar Apr 30 '24 13:04 sftim

Deploy Preview for kubernetes-io-ar-staging ready!

Name Link
Latest commit df3fcd24e01fbdabf89fd6ec02a286e9e5d0e9fe
Latest deploy log https://app.netlify.com/sites/kubernetes-io-ar-staging/deploys/66312915302a330008d59514
Deploy Preview https://deploy-preview-46042--kubernetes-io-ar-staging.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Apr 30 '24 17:04 netlify[bot]

Let's build on that. Can we make the customisations only apply using the cascade when dir is rtl? (We can pair you up with someone who knows SCSS to help make that happen).

I created here a simplified example blue navbar is the current implementation and the green my suggestion. Both are shown in their default state and when using RTL.: https://www.codeply.com/p/bNdMgLE0A5

mboukhalfa avatar Apr 30 '24 22:04 mboukhalfa

As drafted, this change makes the top nav not look right in narrow viewports for LTR locales. I'd really like to see something that doesn't regress (partially break) our existing localizations, which are all LTR.

sftim avatar May 01 '24 17:05 sftim

As drafted, this change makes the top nav not look right in narrow viewports for LTR locales. I'd really like to see something that doesn't regress (partially break) our existing localizations, which are all LTR.

I understand your concerns! Please note that this draft serves as a minimal PoC to highlight the primary issue [ Menu and Logo should switch sides when using dir="RTL" ]. The final solution would be refined for example now the position of the logo is not aligned with the menu and that's related to other misuse ( semantically and make it hard to position ) such as setting the logo as a background image to an element. https://github.com/kubernetes/website/blob/99a199583c516513f54b15c3818eba416e2a83da/assets/scss/_custom.scss#L149

Rest assured that the final solution (targeting main) will treat all those side issues however for now I am looking for guidance and experts here willing to review the work

mboukhalfa avatar May 04 '24 07:05 mboukhalfa

draft

/retitle [WIP] Adapt nav bar to support RTL locales

If this is a work in progress, we should mark it as such (in case someone approves it without realizing).

sftim avatar May 06 '24 21:05 sftim

If this is a work in progress, we should mark it as such (in case someone approves it without realizing).

Thanks I was not worried about this since it is targeting a dev branch

mboukhalfa avatar May 07 '24 01:05 mboukhalfa

It's best not to merge work-in-progress PRs to a localization branch; remember that we intend one day to merge all of that work into main.

sftim avatar May 07 '24 09:05 sftim

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Aug 05 '24 10:08 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Sep 04 '24 10:09 k8s-triage-robot

/remove-lifecycle rotten /lifecycle stale

@mboukhalfa what are your plans for this PR?

sftim avatar Sep 04 '24 11:09 sftim

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Oct 04 '24 11:10 k8s-triage-robot