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

Add RTL support #268

Merged
merged 22 commits into from
Apr 2, 2020
Merged

Add RTL support #268

merged 22 commits into from
Apr 2, 2020

Conversation

DiegoCardoso
Copy link
Contributor

Fix #267

  • Update styles to cover for RTL mode
  • Update position logic when in RTL
  • Update keyboard navigation to work for RTL
  • Add integration tests and visual tests

@CLAassistant
Copy link

CLAassistant commented Mar 25, 2020

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@yuriy-fix yuriy-fix left a comment

Choose a reason for hiding this comment

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

There are several minor bugs.

  1. On the visual tests there is right indent coming from somewhere on default-tests-lumo-rtl (could be correlated with the next two things).

  2. On Edge there is a problem with initial indents for items:

Screen Shot 2020-03-30 at 10 15 23

Screen Shot 2020-03-30 at 10 13 20

  1. On IE there is problem with arrow indents:

Screen Shot 2020-03-30 at 10 16 35

bower.json Outdated Show resolved Hide resolved
bower.json Outdated Show resolved Hide resolved
bower.json Outdated Show resolved Hide resolved
src/vaadin-contextmenu-items-mixin.html Outdated Show resolved Hide resolved
test/overlay.html Outdated Show resolved Hide resolved
@DiegoCardoso
Copy link
Contributor Author

There are several minor bugs.

  1. On the visual tests there is right indent coming from somewhere on default-tests-lumo-rtl (could be correlated with the next two things).

I guess that’s ok, since the Bottom menu is a bit off comparing to the other items (Plain, Long menu and Items). You can check that the same goes with the current visual test in master:
https://github.com/vaadin/vaadin-context-menu/blob/master/test/visual/screens/vaadin-context-menu/default-tests-lumo/bottom-menu/chrome.png

2.On Edge there is a problem with initial indents for items:

That seems to be a issue with the current implementation and not introduced on this ticket. Created a ticket for that https://github.com/vaadin/vaadin-context-menu/issues/269

@DiegoCardoso
Copy link
Contributor Author

  1. On IE there is problem with arrow indents:

Fixed. I splitted the styles so I could remove setting back margins and paddings to initial value.

test/overlay.html Outdated Show resolved Hide resolved
src/vaadin-context-menu.html Outdated Show resolved Hide resolved
} else if (parent && (parentContentRect.left >= parentContentRect.width)) {
// Sub-menu is displayed in the left side of root menu If it is nested menu
style.right = (wdthVport - parentContentRect.right + parentContentRect.width) + 'px';
} else if (parent) { // Sub-menu is displayed in the right side of root menu If it is nested menu
Copy link
Contributor

Choose a reason for hiding this comment

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

A bit confused over here: if sub-menu is displayed in the right side of root menu why we are setting right-aligned below. 🤔It means that it's the same as in ltr above displayed in the left side. Should it work this way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the name right-aligned became a bit misleading now, but I didn't want to touch it, as it could somehow be a breaking change. But basically, from what I could understand, that attribute means that the context-menu will open a sub-menu towards the opposite direction of the "natural flow". So, in the sense of the rtl, right-aligned means left-aligned (😅).

Copy link
Contributor

Choose a reason for hiding this comment

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

We can actually consider renaming that one to smth like end-aligned | aligned-end. Not sure if it is a blocker, but we can at least ask from the team :)

test/overlay.html Outdated Show resolved Hide resolved
test/overlay.html Outdated Show resolved Hide resolved
test/overlay.html Outdated Show resolved Hide resolved
Copy link
Contributor

@yuriy-fix yuriy-fix left a comment

Choose a reason for hiding this comment

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

One small suggestion about right-aligned, otherwise well done.

- right-aligned is misleading in RTL mode. Change to end-aligned
- Still use 'right-aligned' along in LTR
- Mark right-aligned as deprecated
- Change __isRTL to be a getter instead of method
@DiegoCardoso DiegoCardoso merged commit a51e678 into master Apr 2, 2020
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.

Add RTL specific styles
3 participants