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 missing map pins on rtl site #917

Merged
merged 2 commits into from
Aug 16, 2021
Merged

Fix missing map pins on rtl site #917

merged 2 commits into from
Aug 16, 2021

Conversation

yen-tt
Copy link
Contributor

@yen-tt yen-tt commented Aug 13, 2021

  • use ltr instead of rtl attribute in the map div since switching to rtl would disrupt the coordinate to css mapping calculated by the map providers
  • adjust map boundaries based on location of the result content wrapper, which could be left or right of the viewpoint (ltr or rtl)

J=SLAP-1515
TEST=manual

  • launched multilang site, see that pins on map on arabic is present and the pin locations matched with the ones on english page.

- use ltr instead of rtl in the map div since that would disrupt the coordinate calcualted by the map providers
- adjust map boundaries based on location of the result content wrapper, since that could be placed left or right of the viewpoint (ltr or rtl)

J=SLAP-1515
TEST=manual

- launched multilang site, see that pins on map on arabic is present and the pin locations matched with the ones on english page.
@coveralls
Copy link

coveralls commented Aug 13, 2021

Coverage Status

Coverage decreased (-0.02%) to 7.303% when pulling f1c1e86 on dev/map-pin-arabic into 95c5996 on develop.

@yen-tt yen-tt requested review from oshi97 and cea2aj August 16, 2021 18:03
@@ -3,7 +3,7 @@ import { PinImages } from './PinImages.js';
import { ClusterPinImages } from './ClusterPinImages.js';
import { getLanguageForProvider } from './Util/helpers.js';
import { defaultCenterCoordinate } from './constants.js';

import isRTL from '../../common/rtl';
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: line break after

@@ -238,11 +238,12 @@ export default class ThemeMapConfig {
}

/**
* Get the leftmost point on the map, such that pins will still be visible
* Get the leftmost or rightmost point on the map, such that pins will still be visible
Copy link
Contributor

@oshi97 oshi97 Aug 16, 2021

Choose a reason for hiding this comment

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

Maybe leftmost point on the map, or rightmost for RTL locales,?

@@ -1 +1 @@
<div id="js-answersMap" class="Answers-map js-answersMap"></div>
<div id="js-answersMap" class="Answers-map js-answersMap" dir="ltr"></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

we don't want to flip the map for rtl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it mess with and pin placement (specifically the coordinate to css styling translation) on the map

Copy link
Contributor

Choose a reason for hiding this comment

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

does this cause the map to not be oriented correctly, for either google/mapbox? Like disregarding pin stuff, does anything else change if you add dir="ltr" on a rtl page

Copy link
Contributor Author

@yen-tt yen-tt Aug 16, 2021

Choose a reason for hiding this comment

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

the map is oriented the same way for both ltr and rtl, only the pins are affected. the div that I added dir='ltr' only contains map related things like the canvas for the map and the pin clusters which we don't want rtl on. There's also the map control html elements but the position for those are specify for ltr and rtl in the map provider construction code. everything else on the page would follow ltr. tldr: nothing else change when I tested google and mapbox on the map pages

Copy link
Contributor

Choose a reason for hiding this comment

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

got it awesome!!

@yen-tt yen-tt merged commit 75d30ee into develop Aug 16, 2021
@yen-tt yen-tt deleted the dev/map-pin-arabic branch August 16, 2021 20:37
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.

3 participants