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

[Drawer] Fix behavior on RTL layouts #6857

Merged
merged 2 commits into from May 15, 2017

Conversation

alireza-ahmadi
Copy link

  • PR has tests / docs demo, and is linted.
  • Commit and PR titles begin with [ComponentName], and are in imperative form: "[Component] Fix leaky abstraction".
  • Description explains the issue / use-case resolved, and auto-closes the related issue(s) (http://tr.im/vFqem).

As reported in #5603, If you set isRtl: true, Drawer component swipe to open and close does not work as expected. In fact, a sidebar that located on the right of the screen opens by swiping from the left while it should get opened by swiping from the right. Also, an open drawer can get closed by swiping to the left, while it should get closed by swiping to the right.

This pull request applies some minor changes to detect isRtl and change swipe behavior based on that.

Please let me know if any changes required.

- Fix swipe to open and close bugs of drawer on RTL layouts
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Works great 👍
That was pretty insane before this PR:
mai-14-2017 20-16-14

@@ -246,7 +246,9 @@ class Drawer extends Component {
onBodyTouchStart = (event) => {
const swipeAreaWidth = this.props.swipeAreaWidth;

const touchStartX = event.touches[0].pageX;
const touchStartX = !this.context.muiTheme.isRtl ?
Copy link
Member

Choose a reason for hiding this comment

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

No need for a negation (!) here and everywhere else in that PR.

Copy link
Author

Choose a reason for hiding this comment

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

@oliviertassinari Thanks for the review 🙏. Removed unnecessary negations from the code, please let me know if any other changes required.

@oliviertassinari oliviertassinari changed the title [Drawer] fix strange behavior on RTL layouts [Drawer] Fix behavior on RTL layouts May 14, 2017
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: drawer This is the name of the generic UI component, not the React module! labels May 14, 2017
@oliviertassinari
Copy link
Member

@alireza-ahmadi Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: drawer This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants