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

Fixes broken style when using MapboxDirections and MapboxGeocoder #226

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

alexshk
Copy link

@alexshk alexshk commented Sep 8, 2019

mapbox-gl-directions and mapbox-gl-geocoder both have conflicting .mapboxgl-ctrl-geocoder CSS class. This PR adds a scoped class to fix the issue.

@alexshk alexshk changed the title Fix for #223 Fixes broken style when using MapboxDirections and MapboxGeocoder Sep 8, 2019
@@ -23,7 +23,7 @@ export default class Geocoder {

// Template
var el = document.createElement('div');
el.className = 'mapboxgl-ctrl-geocoder';
el.className = 'mapboxgl-ctrl-geocoder mapboxgl-ctrl-geocoder-directions';

Choose a reason for hiding this comment

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

Is there a reason we can't use replace mapboxgl-ctrl-geocoder here with mapboxgl-ctrl-geocoder-directions?

Copy link
Author

Choose a reason for hiding this comment

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

Actually, that was my first thought. But this will break styles for the guys who already using current class name, this why I added additional class

Choose a reason for hiding this comment

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

But does this mean if I'm changing styles for the MapboxGeocoder I'll inadvertently also change the style used by MapboxDirections?

Copy link
Author

Choose a reason for hiding this comment

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

Theoretically, it is possible to break style by adding something in MapboxGeocoder, but I don't think this may happen. For example outline: 2px solid red in MapboxGeocder styles will add a red outline for MapboxDirections because outline isn't overridden in MapboxDirections styles.

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.

4 participants