Skip to content

Commit e42071b

Browse files
committed
Improve a11y of the color picker button
1 parent 12cebba commit e42071b

3 files changed

Lines changed: 10 additions & 4 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.

0 commit comments

Comments
 (0)