-
Notifications
You must be signed in to change notification settings - Fork 83
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(Accessibility): Color alone is used to convey information #336
base: master
Are you sure you want to change the base?
Conversation
LGTM. |
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.
So as to not break the component layout. We should use coral-tooltip to show the value. To provide the suggested changes, I implemented this locally. Should I commit those changes to this PR?
@@ -0,0 +1 @@ | |||
<label handle="colorLabel" type="label"></label> |
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.
Simply including the color value as a block element breaks the layouts of both the ColorInput and ColorInputSwatches. It may be better to use a CoralTooltip to display the value on hover or focus.
<label handle="colorLabel" type="label"></label> | |
<coral-tooltip handle="colorLabel" placement="top" class="_coral-ColorInput-swatch-tooltip"></coral-tooltip> |
<button handle="colorPreview" is="coral-button" variant="_custom" class="_coral-FieldButton _coral-ColorInput-button _coral-ColorInput-preview" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="{{uid}}"></button> | ||
<label handle="colorPreviewLabel" type="label"></label> |
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.
Simply including the color value as a block element breaks the layouts of both the ColorInput and ColorInputSwatches. It may be better to use a CoralTooltip to display the value on hover or focus.
<button handle="colorPreview" is="coral-button" variant="_custom" class="_coral-FieldButton _coral-ColorInput-button _coral-ColorInput-preview" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="{{uid}}"></button> | |
<label handle="colorPreviewLabel" type="label"></label> | |
<button handle="colorPreview" is="coral-button" variant="_custom" class="_coral-FieldButton _coral-ColorInput-button _coral-ColorInput-preview" type="button" aria-haspopup="dialog" aria-expanded="false" aria-controls="{{uid}}" id="{{uid}}-colorPreview" aria-describedby="{{uid}}-tooltip"></button> | |
<coral-tooltip handle="colorPreviewLabel" class="_coral-ColorInput-preview-tooltip" id="{{uid}}-tooltip" target="#{{uid}}-colorPreview" placement="top"></coral-tooltip> | |
colorButton.call(this._elements); | ||
colorLabel.call(this._elements); |
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.
Pass commons
through to the colorButton
template so that we can call generate a uid
within the template.
colorButton.call(this._elements); | |
colorLabel.call(this._elements); | |
colorButton.call(this._elements, {commons}); | |
colorLabel.call(this._elements); |
@@ -107,10 +109,12 @@ const ColorInputSwatch = Decorator(class extends BaseColorInputAbstractSubview(B | |||
if (cssColorValue) { | |||
this._elements.colorButton.style.backgroundColor = cssColorValue; | |||
this._elements.colorButton.label.textContent = hexColorValue; | |||
this._elements.colorLabel.textContent = hexColorValue; |
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.
Using coral-tooltip
we set the textContent
of the content
element.
this._elements.colorLabel.textContent = hexColorValue; | |
this._elements.colorLabel.content.textContent = hexColorValue; |
this.setAttribute('data-value', hexColorValue); | ||
} else { | ||
this._elements.colorButton.classList.add('_coral-ColorInput-swatch-novalue'); | ||
this._elements.colorButton.label.textContent = i18n.get('unset'); | ||
this._elements.colorLabel.textContent = i18n.get('unset'); |
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.
Using coral-tooltip we set the textContent of the content element.
this._elements.colorLabel.textContent = i18n.get('unset'); | |
this._elements.colorLabel.content.textContent = i18n.get('unset'); |
this.appendChild(this._elements.colorButton); | ||
this.appendChild(this._elements.colorLabel); |
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.
The coral-tooltip
should target the colorButton
element.
this.appendChild(this._elements.colorLabel); | |
this.appendChild(this._elements.colorLabel); | |
this._elements.colorLabel.target = '#' + this._elements.colorButton.id; |
|
||
label { | ||
display block; | ||
} |
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.
Fix text wrapping:
label { | |
display block; | |
} | |
._coral-ColorInput-swatch-tooltip { | |
min-width: max-content; | |
} |
} | ||
|
||
._coral-ColorInput-buttonWrapper { | ||
position: absolute; | ||
right: $colorinput-button-wrapper-offset; | ||
top: $colorinput-button-wrapper-offset; | ||
text-align: center; | ||
|
||
// set opacity < 1 to create new stacking context (for checker image to work) | ||
opacity: .999; |
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.
Fix text wrapping within tooltip:
opacity: .999; | |
opacity: .999; | |
._coral-ColorInput-preview-tooltip { | |
min-width: max-content; | |
} |
…oral-spectrum into issue/SITES-10934
Hello @majornista @Pareesh . I see that all the comments have been resolved and I updated the branch with the latest master branch. Can you please approve & merge this PR when you have some time? |
https://jira.corp.adobe.com/browse/SITES-10934
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: