-
Notifications
You must be signed in to change notification settings - Fork 129
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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'; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
What's blocking this PR? https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-directions/v4.1.0/mapbox-gl-directions.css is still clashing with https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.5.1/mapbox-gl-geocoder.css with ruins its UI. |
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.