Skip to content

Commit b948db5

Browse files
authored
Merge pull request #6626 from WoltLab/63-color-picker-button
Improve a11y of the color picker button
2 parents 791bd93 + e42071b commit b948db5

4 files changed

Lines changed: 13 additions & 6 deletions

File tree

com.woltlab.wcf/templates/shared_colorFormField.tpl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
<span{if $field->getValue()} style="background-color: {$field->getValue()}"{/if}></span>
44
</span>
55
{else}
6-
<a href="#" class="colorPickerButton jsTooltip" id="{$field->getPrefixedId()}_colorPickerButton" title="{lang}wcf.style.colorPicker.button.changeColor{/lang}" data-store="{$field->getPrefixedId()}">
6+
<button
7+
type="button"
8+
class="colorPickerButton jsTooltip"
9+
id="{$field->getPrefixedId()}_colorPickerButton"
10+
title="{lang}wcf.style.colorPicker.button.changeColor{/lang}"
11+
data-store="{$field->getPrefixedId()}"
12+
>
713
<span{if $field->getValue()} style="background-color: {$field->getValue()}"{/if}></span>
8-
</a>
14+
</button>
915
<input type="hidden" {*
1016
*}id="{$field->getPrefixedId()}" {*
1117
*}name="{$field->getPrefixedId()}" {*

ts/WoltLabSuite/Core/Ui/Color/Picker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class UiColorPicker implements DialogCallbackObject {
401401
this.oldColor!.style.backgroundColor = colorString;
402402
this.input.value = colorString;
403403

404-
if (!(this.element instanceof HTMLButtonElement)) {
404+
if (!(this.element instanceof HTMLButtonElement) || this.element.classList.contains("colorPickerButton")) {
405405
const span = this.element.querySelector("span");
406406
if (span) {
407407
span.style.backgroundColor = colorString;

wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Color/Picker.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wcfsetup/install/files/style/ui/colorPicker.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@
2727
}
2828

2929
.colorPickerButton {
30-
height: 32px;
30+
border-radius: var(--wcfBorderRadius);
31+
height: 50px;
3132
width: 50px;
3233

3334
> span {
34-
height: 32px;
35+
height: 50px;
3536
}
3637
}
3738

0 commit comments

Comments
 (0)