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

[WIP] Adapt nav bar to support RTL locales #46042

Open
wants to merge 1 commit into
base: dev-1.29-ar.1
Choose a base branch
from

Conversation

mboukhalfa
Copy link
Member

@mboukhalfa mboukhalfa commented Apr 28, 2024

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: #45077

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

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

@k8s-ci-robot k8s-ci-robot added language/ar Issues or PRs related to Arabic language cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 28, 2024
@adowair
Copy link

adowair commented Apr 28, 2024

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

@mboukhalfa
Copy link
Member Author

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 mboukhalfa force-pushed the Adapt-navbar-to-support-RTL/mboukhalfa branch from 9324d21 to 89d3e7f Compare April 28, 2024 12:22
@adowair
Copy link

adowair commented Apr 28, 2024

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!

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. area/blog Issues or PRs related to the Kubernetes Blog subproject area/release-eng Issues or PRs related to the Release Engineering subproject language/de Issues or PRs related to German language language/en Issues or PRs related to English language language/es Issues or PRs related to Spanish language language/fr Issues or PRs related to French language language/hi Issues or PRs related to Hindi language language/id Issues or PRs related to Indonesian language language/it Issues or PRs related to Italian language language/ja Issues or PRs related to Japanese language language/ko Issues or PRs related to Korean language language/pl Issues or PRs related to Polish language language/pt Issues or PRs related to Portuguese language language/ru Issues or PRs related to Russian language language/uk Issues or PRs related to Ukrainian language language/vi Issues or PRs related to Vietnamese language language/zh Issues or PRs related to Chinese language and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 28, 2024
@k8s-ci-robot k8s-ci-robot removed area/blog Issues or PRs related to the Kubernetes Blog subproject area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. labels Apr 29, 2024
@sftim
Copy link
Contributor

sftim commented Apr 30, 2024

/area web-development
/area localization

@k8s-ci-robot k8s-ci-robot added area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes area/localization General issues or PRs related to localization labels Apr 30, 2024
@sftim
Copy link
Contributor

sftim commented Apr 30, 2024

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(?)

@mboukhalfa
Copy link
Member Author

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 : twbs/bootstrap#22780

@sftim
Copy link
Contributor

sftim commented Apr 30, 2024

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).

@@ -130,7 +130,7 @@ body.td-404 main .error-details {
transition: 0.3s;

.navbar-brand {
position: absolute;
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's only override this for RTL locales.

Copy link
Contributor

Choose a reason for hiding this comment

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

Where possible, I'd prefer to make the customisations here conditional on the locale's text direction.

@mboukhalfa
Copy link
Member Author

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 google/docsy#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.

@sftim
Copy link
Contributor

sftim commented Apr 30, 2024

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.

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 commit adapt the navbar styling to automatically support RTL direction

Signed-off-by: Mohammed Boukhalfa <mohammed.boukhalfa@est.tech>
@mboukhalfa mboukhalfa force-pushed the Adapt-navbar-to-support-RTL/mboukhalfa branch from 3930e90 to df3fcd2 Compare April 30, 2024 17:23
Copy link

netlify bot commented Apr 30, 2024

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

Name Link
🔨 Latest commit df3fcd2
🔍 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.

@mboukhalfa
Copy link
Member Author

mboukhalfa commented Apr 30, 2024

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

@sftim
Copy link
Contributor

sftim commented May 1, 2024

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.

@mboukhalfa
Copy link
Member Author

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.

background-image: url("/images/nav_logo.svg");

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

@sftim
Copy link
Contributor

sftim commented May 6, 2024

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).

@k8s-ci-robot k8s-ci-robot changed the title [ar] Adapt navbar to support RTL langs [WIP] Adapt nav bar to support RTL locales May 6, 2024
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 6, 2024
@mboukhalfa
Copy link
Member Author

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

@sftim
Copy link
Contributor

sftim commented May 7, 2024

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.

@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/localization General issues or PRs related to localization area/web-development Issues or PRs related to the kubernetes.io's infrastructure, design, or build processes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. language/ar Issues or PRs related to Arabic language lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/docs Categorizes an issue or PR as relevant to SIG Docs. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants