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: add app content wrapper padding based on page text direction(ltr or rtl) #1250

Closed
wants to merge 1 commit into from

Conversation

muhammad-ammar
Copy link
Contributor

Description: Add padding(left or right) baesd on the page text direction(ltr or rtl)

For all changes

  • Ensure adequate tests are in place (or reviewed existing tests cover changes)

Only if submitting a visual change

  • Ensure to attach screenshots
  • Ensure to have UX team confirm screenshots

@muhammad-ammar muhammad-ammar changed the title fix: add app content wrapper padding based on page text direction(ltr, rtl) fix: add app content wrapper padding based on page text direction(ltr or rtl) Jun 10, 2024
@@ -141,7 +143,7 @@ class EnterpriseApp extends React.Component {
tabIndex="-1"
ref={this.contentWrapperRef}
style={{
paddingLeft: matchesMediaQ ? sidebarWidth : defaultContentPadding,
[isLocaleRTL ? 'paddingRight' : 'paddingLeft']: matchesMediaQ ? sidebarWidth : defaultContentPadding,
Copy link
Member

Choose a reason for hiding this comment

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

[suggestion] Rather than relying on getLocale and isRtl here, I would recommend a pure CSS solution with paddingInlineStart here instead, the primary reasons being:

  1. It's a simpler implementation.
  2. Can respond to manual changes of the dir="ltr" attribute on the <html> element, whereas this solution would not. For example, if you manually change the <html> element's dir="ltr" attribute in DevTools to dir="rtl", the padding is not properly updated with the current approach.

The padding-inline-start CSS property (docs) takes into account LTR vs. RTL directionality by default.

Example screenshot, after manually changing to dir="rtl" in DevTools and relying on paddingInlineStart:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants