Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

fix: apply correct RTL margins #527

Merged
merged 1 commit into from
Feb 13, 2018

Conversation

atscott
Copy link
Contributor

@atscott atscott commented Dec 7, 2017

Fixes #274

/** The current 'ltr' or 'rtl' value. */
readonly value: Direction = 'ltr';

constructor(@Optional() @Inject(DIR_DOCUMENT) _document?: any) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you're not importing the DOCUMENT token from angular/common? This is why Travis is failing on prerender, it doesn't have access to the global browser document object

@atscott atscott force-pushed the atscott/fix-274 branch 2 times, most recently from 20334be to bfb85cc Compare December 12, 2017 18:58
@atscott
Copy link
Contributor Author

atscott commented Dec 12, 2017

The @angular/cdk was only in dev dependencies (for the demo, I think). I've moved it to the dependency list and am now using the Directionality injectable from the bidi module.

@CaerusKaru
Copy link
Member

Excellent, I thought it was in the deps because it's available in the rollup globals, but I guess it was left out (this just means you need to do less work to include the cdk).

@atscott
Copy link
Contributor Author

atscott commented Dec 13, 2017

FYI - current broken test is also failing in master

@CaerusKaru
Copy link
Member

Rebase with master should fix broken test

@atscott
Copy link
Contributor Author

atscott commented Dec 14, 2017

Done, thanks.

@atscott
Copy link
Contributor Author

atscott commented Jan 2, 2018

Friendly post-holiday ping. Anything that needs to be done to get this merged? RTL support is pretty important to my team.

@CaerusKaru
Copy link
Member

CaerusKaru commented Jan 2, 2018

It would be great if you could add a demo that displays RTL in the demo-app, just something simple that documents the capability.

Also, please change your commit message to something in line with the Angular contribution guidelines, found here

Finally, the PR lists this as a partial fix for #274, are there cases that this does not cover, and can you list that in the commit message?

Other than that the PR LGTM, I'll see what I can do to get it merged in the next week or so (it has to go through internal presubmit tests first)

@atscott atscott changed the title partial fix for #274. Apply correct rtl margins Fix for #274. Apply correct rtl margins Jan 2, 2018
@atscott
Copy link
Contributor Author

atscott commented Jan 3, 2018

Updated commit message (I think).

The "partial fix" in the description was from when I wasn't using the angular cdk dir directive. This should be a full fix of what was requested in that bug.

I haven't looked much yet at where to put this in the demo app. I wasn't able to get the demo app running.

@CaerusKaru
Copy link
Member

CaerusKaru commented Jan 3, 2018

You need to squash your commits into one with a rebase. If there is an issue with the demo-app, can you post it as a new issue so we can take a look?

Also the scope can be empty, i.e. fix: add RTL support

@atscott atscott force-pushed the atscott/fix-274 branch 2 times, most recently from c719fea to 925216c Compare January 3, 2018 17:47
@atscott
Copy link
Contributor Author

atscott commented Jan 3, 2018

Rebased and filed #547

@CaerusKaru
Copy link
Member

#547 has been patched in #549. Please incorporate the change (it's one line) and add a demo to the demo-app, leaving out the one-line change in your final commit.

@CaerusKaru CaerusKaru changed the title Fix for #274. Apply correct rtl margins fix: apply correct RTL margins Jan 4, 2018
@atscott
Copy link
Contributor Author

atscott commented Jan 4, 2018

Added the demo and updated the implementations to subscribe to the direction changes.

super(monitor, elRef, renderer);

if (container) { // Subscribe to layout direction changes
this._layoutWatcher = container.layout$.subscribe(this._onLayoutChange.bind(this));
}

this._directionWatcher =
this._directionality.change.subscribe(() => this._updateWithValue());
Copy link
Member

Choose a reason for hiding this comment

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

This should be the same as the _layoutWatcher subscription:

this._directionality.change.subscribe(this._updateWithValue.bind(this));

@CaerusKaru
Copy link
Member

Demo looks great, thanks 👍

@CaerusKaru CaerusKaru added pr: lgtm This PR has been approved by the reviewer pr: needs presubmit and removed pr: needs review labels Jan 4, 2018
@CaerusKaru CaerusKaru self-assigned this Jan 4, 2018
@CaerusKaru CaerusKaru added pr: needs cleanup/tests and removed pr: on hold pr: lgtm This PR has been approved by the reviewer labels Feb 2, 2018
Copy link
Member

@CaerusKaru CaerusKaru left a comment

Choose a reason for hiding this comment

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

Hey @atscott, I've discussed this with @ThomasBurleson and here's what we need you to do:

  • Clean up this PR (rebase/refactor as necessary)
  • Clone the BiDi code from the CDK since it's low-complexity (and remove the explicit dependency)
  • We'll get this in for the beta.14 release at the beginning of next month

@googlebot googlebot added cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ and removed cla: yes labels Feb 3, 2018
@atscott atscott force-pushed the atscott/fix-274 branch 4 times, most recently from 8737be3 to 1433946 Compare February 3, 2018 01:11
@ThomasBurleson
Copy link
Contributor

@atscott - The reason we want to clone the Directionality class is to avoid introducing an explicit dependency on the CDK at this time.

Later, major portions of the library [ e.g. /src/lib/mediaquery] may be migrated to the CDK and then the @angular/flex-layout dependency on the CDK will be acceptable.

@atscott atscott force-pushed the atscott/fix-274 branch 2 times, most recently from 453062b to 5727752 Compare February 5, 2018 20:26
Copy bidi module from angular material cdk so there's not a new
dependency.
@atscott
Copy link
Contributor Author

atscott commented Feb 5, 2018

Alright, that sounds good. I made those changes (had trouble rebasing so kind of redid the whole thing) and I think everything's all set.

@CaerusKaru CaerusKaru added cla: yes pr: lgtm This PR has been approved by the reviewer and removed cla: no PR author needs to sign Google's CLA: https://opensource.google.com/docs/cla/ pr: needs cleanup/tests labels Feb 5, 2018
Copy link
Member

@CaerusKaru CaerusKaru left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@angular angular deleted a comment from googlebot Feb 9, 2018
@ThomasBurleson ThomasBurleson merged commit 7699957 into angular:master Feb 13, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes pr: lgtm This PR has been approved by the reviewer related: material2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RTL support?
4 participants