-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 some failed results from Web map tools WCAG 2.1 evaluation #9991
Changes from 1 commit
ee0767a
1a2e5d1
705ae34
5eff9d7
27c6496
5c7abbd
5eb9ff9
67282f4
1380141
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ class AttributionControl { | |
this.options = options; | ||
|
||
bindAll([ | ||
'_toggleAttribution', | ||
'_updateEditLink', | ||
'_updateData', | ||
'_updateCompact' | ||
|
@@ -53,7 +54,12 @@ class AttributionControl { | |
|
||
this._map = map; | ||
this._container = DOM.create('div', 'mapboxgl-ctrl mapboxgl-ctrl-attrib'); | ||
this._compactButton = DOM.create('button', 'mapboxgl-ctrl-attrib-button', this._container); | ||
this._compactButton.addEventListener('click', this._toggleAttribution); | ||
this._setButtonTitle(this._compactButton, 'ToggleAttribution'); | ||
this._compactButton.setAttribute('role', 'button'); | ||
tristen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this._innerContainer = DOM.create('div', 'mapboxgl-ctrl-attrib-inner', this._container); | ||
this._innerContainer.setAttribute('role', 'list'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment about this feature is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, |
||
|
||
if (compact) { | ||
this._container.classList.add('mapboxgl-compact'); | ||
|
@@ -86,16 +92,32 @@ class AttributionControl { | |
this._attribHTML = (undefined: any); | ||
} | ||
|
||
_setButtonTitle(button: HTMLButtonElement, title: string) { | ||
const str = this._map._getUIString(`AttributionControl.${title}`); | ||
button.title = str; | ||
button.setAttribute('aria-label', str); | ||
} | ||
|
||
_toggleAttribution() { | ||
if (this._container.classList.contains('mapboxgl-compact-show')) { | ||
this._container.classList.remove('mapboxgl-compact-show'); | ||
this._compactButton.setAttribute('aria-pressed', 'false'); | ||
} else { | ||
this._container.classList.add('mapboxgl-compact-show'); | ||
this._compactButton.setAttribute('aria-pressed', 'true'); | ||
} | ||
} | ||
|
||
_updateEditLink() { | ||
let editLink = this._editLink; | ||
if (!editLink) { | ||
editLink = this._editLink = (this._container.querySelector('.mapbox-improve-map'): any); | ||
} | ||
|
||
const params = [ | ||
{key: "owner", value: this.styleOwner}, | ||
{key: "id", value: this.styleId}, | ||
{key: "access_token", value: this._map._requestManager._customAccessToken || config.ACCESS_TOKEN} | ||
{key: 'owner', value: this.styleOwner}, | ||
{key: 'id', value: this.styleId}, | ||
{key: 'access_token', value: this._map._requestManager._customAccessToken || config.ACCESS_TOKEN} | ||
Comment on lines
+118
to
+120
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not a necessary change but I just came across this string inconsistency. |
||
]; | ||
|
||
if (editLink) { | ||
|
@@ -106,7 +128,8 @@ class AttributionControl { | |
return acc; | ||
}, `?`); | ||
editLink.href = `${config.FEEDBACK_URL}/${paramString}${this._map._hash ? this._map._hash.getHashString(true) : ''}`; | ||
editLink.rel = "noopener nofollow"; | ||
editLink.rel = 'noopener nofollow'; | ||
this._setButtonTitle(editLink, 'MapFeedback'); | ||
} | ||
} | ||
|
||
|
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.
I think the compact attribution could use a bit more space between the text and the button. When the button is focused, which it is when the control is first maximized after clicking it or hitting Enter, the blue focus ring abuts the text pretty tightly.
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.
Increased padding in 67282f4 to address this!