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

attributionControl broken when compacted and given optional customAttribution string #7440

Closed
ruizdurazo opened this issue Oct 18, 2018 · 3 comments
Labels

Comments

@ruizdurazo
Copy link

mapbox-gl-js version: 0.50.0

browser: Chrome

Steps to Trigger Behavior

  1. Create a new map with attributionControl set to false.
  2. Create a new mapboxgl.AttributionControl given the compact option set to true and a customAtribution string specified.

Code

mapboxgl.accessToken = "-----------"

map = new mapboxgl.Map({
  attributionControl: false,
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v9',
  center: [0, 0],
  zoom: 0
})

map.addControl(new mapboxgl.AttributionControl({
  compact: true,
  customAttribution: "Example string"
}))

image

Expected Behavior

The customAttribution string would be compacted and hidden along with the default attributions.

Actual Behavior

The customAttribution string seems to be completely separate from the default attributions.

@ryanhamley
Copy link
Contributor

Thanks for the report @ruizdurazo This seems to be a side effect of #7391 but it looks like a simple fix. I'll have a PR up shortly.

@areichman
Copy link

I saw this issue when upgrading from 0.47 to 0.51. I'm setting a custom attribution in a source style:

map.addSource({
  type: 'raster',
  attribution: 'My Data <a href="https://my.com" target="_blank" rel="noopener">© My Company</a>',
  ...
})

Using a string with an anchor tag like this, the non-anchor text still bleeds out like shown in the original screenshot. For now, I've moved everything into the anchor text and it works as expected.

@ryanhamley
Copy link
Contributor

@areichman the bug you describe should be fixed by #7608 which just merged to master and will be part of 0.52. I tested out the attribution in your example on the current master branch and it works as expected in both compact and normal attributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants