Skip to content

Comments

Handle RTL in modals#2864

Merged
chrisgarrity merged 3 commits intoscratchfoundation:developfrom
chrisgarrity:feature/2759-modals
Aug 16, 2018
Merged

Handle RTL in modals#2864
chrisgarrity merged 3 commits intoscratchfoundation:developfrom
chrisgarrity:feature/2759-modals

Conversation

@chrisgarrity
Copy link
Contributor

@chrisgarrity chrisgarrity commented Aug 14, 2018

Resolves

What Github issue does this resolve (please include link)?

Proposed Changes

Describe what this Pull Request does
Wraps the modal content in a <div dir=... and sets the direction based on the isRtl state. Handles all the modals that use ReactModal directly not the Modal component.

Test Coverage

Try it:
https://chrisgarrity.github.io/scratch-gui/feature/2759-modals/?locale=he

Manual Testing:

  • Beta modal - button layout is rtl
  • import project modal - back arrow is reversed and input field is reversed
  • WebGL modal - text is RTL
  • unsupported browser modal - text is RTL

Browser Coverage

Check the OS/browser combinations tested (At least 2)

Mac

  • Chrome
  • Firefox
  • Safari
  • Opera - gets unsupported browser modal

Windows

  • Chrome
  • Firefox
  • Edge

Chromebook

  • Chrome

iPad

  • Safari

Android Tablet

  • Chrome

});

export default connect(
mapStateToProps

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

Copy link
Contributor

@kchadha kchadha left a comment

Choose a reason for hiding this comment

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

One minor comment and also a question --
As far as I can tell, the unsupported browser modal doesn't look any different than before, is that true? And I wasn't sure, but should the image in the unsupported browser modal look any different or be flipped? I don't know if we have any examples of the entire browser changing its layout when in RTL...

@chrisgarrity
Copy link
Contributor Author

I didn't reverse the browser image because it's just a facsimile of a browser window, but I just checked on one of the tablets and the arrows are to the right of the address bar in Chrome so perhaps it should. The other parts didn't change because everything is centered.

Also just cleaner formatting of the connect in the `errorBoundary` container
@chrisgarrity
Copy link
Contributor Author

@kchadha I've added the no-op mapDispatchToProps to the errorBoundary container.

@fsih
Copy link
Contributor

fsih commented Aug 16, 2018

Not a big deal but, I think both arguments to connect are optional and not passing mapDispatchToProps is very common

C:\Users\DD\Git\scratch-gui\src\components\gui\gui.jsx:
318 });
319
320: export default injectIntl(connect(
321: mapStateToProps
322: )(GUIComponent));
323

C:\Users\DD\Git\scratch-gui\src\components\stage-header\stage-header.jsx:
180 };
181
182: export default injectIntl(connect(
183: mapStateToProps
184: )(StageHeaderComponent));
185

C:\Users\DD\Git\scratch-gui\src\containers\custom-procedures.jsx:
191 });
192
193: export default connect(
194: mapStateToProps
195: )(CustomProcedures);
196

C:\Users\DD\Git\scratch-gui\src\containers\modal.jsx:
58 });
59
60: export default connect(
61: mapStateToProps
62: )(Modal);
63

C:\Users\DD\Git\scratch-gui\src\containers\paint-editor-wrapper.jsx:
79 };
80
81: export default connect(
82: mapStateToProps
83: )(PaintEditorWrapper);
84

C:\Users\DD\Git\scratch-gui\src\containers\sound-editor.jsx:
226 };
227
228: export default connect(
229: mapStateToProps
230: )(SoundEditor);

@kchadha
Copy link
Contributor

kchadha commented Aug 16, 2018

@fsih then are we wrong about what creates this warning? Because it wasn't always there...

image

Copy link
Contributor

@kchadha kchadha left a comment

Choose a reason for hiding this comment

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

LGTM

@fsih
Copy link
Contributor

fsih commented Aug 16, 2018

@kchadha That happens because we have a tendency to use "...props" to pass props to components and then accidentally leave too many props in there. Div isn't a react component, so it doesn't know what to do with dispatch. This change gets rid of the warning for me: eb0383b

@chrisgarrity chrisgarrity merged commit 2412c96 into scratchfoundation:develop Aug 16, 2018
@chrisgarrity chrisgarrity deleted the feature/2759-modals branch August 16, 2018 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RTL - Modals

3 participants