mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Compact attribution accessibility attribute missing

Open matteiben-onx opened this issue 1 year ago • 1 comments

Description

https://github.com/mapbox/mapbox-gl-js/pull/12981 removed an accessibility attribution which Lighthouse wants on the compact attribution control.

mapbox-gl-js version: 3.4

browser: Chrome

Steps to Trigger Behavior

  1. Run a simple map using the compact attribution control (source code below)
  2. Run lighthouse report using Chrome dev tools
  3. See failure image posted below

Link to Demonstration

Attribution control does not work in https://jsbin.com, so listing simple source code here.

Run the following in Chrome and run a lighthouse report in the chrome dev tools

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Display a map on a webpage</title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <link href="https://api.mapbox.com/mapbox-gl-js/v3.4.0/mapbox-gl.css" rel="stylesheet">
    <script src="https://api.mapbox.com/mapbox-gl-js/v3.4.0/mapbox-gl.js"></script>
    <style>
      body { margin: 0; padding: 0; }
      #map { position: absolute; top: 0; bottom: 0; width: 100%; }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>
      mapboxgl.accessToken = 'ACCESS_TOKEN'

      const map = new mapboxgl.Map({
        container: 'map',
        center: [-74.5, 40],
        zoom: 9
      })
        
      map.on('load', () => {
        const control = new mapboxgl.AttributionControl({
          compact: true,
        })
        map.addControl(control, 'bottom-left')
      })
    </script>
  </body>
</html>

This will trigger a report with this at the top

Screenshot 2024-07-16 at 10 54 16 AM

The PR removing the accessibility attribution was in release 3.10. Any users gating CI behind a lighthouse check will fail once consuming >= that version.

Expected Behavior

Accessibility attribute aria-label exists.

Actual Behavior

Accessibility attribute is missing

matteiben-onx avatar Jul 16 '24 17:07 matteiben-onx

Related / possible duplicate of https://github.com/mapbox/mapbox-gl-js/issues/13143.

Malvoz avatar Aug 06 '24 10:08 Malvoz

Closing this issue as resolved in v3.6

https://github.com/mapbox/mapbox-gl-js/blob/main/CHANGELOG.md#360

  • Fix accessibility issues with compact attribution button and logo.

matteiben-onx avatar Sep 27 '24 19:09 matteiben-onx