Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion packages/main/src/ColorPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js";
import { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js";
import type { IFormInputElement } from "@ui5/webcomponents-base/dist/features/InputElementsFormSupport.js";
import {
getRGBColor,
Expand Down Expand Up @@ -136,6 +137,24 @@ class ColorPicker extends UI5Element implements IFormInputElement {
@property({ type: Boolean })
simplified = false;

/**
* Defines the accessible name of the component.
* @default undefined
* @public
* @since 2.20.0
*/
@property()
accessibleName?: string;

/**
* Receives id(or many ids) of the elements that label the component.
* @default undefined
* @public
* @since 2.20.0
*/
@property()
accessibleNameRef?: string;

/**
* Defines the current main color which is selected via the hue slider and is shown in the main color square.
* @private
Expand Down Expand Up @@ -556,7 +575,10 @@ class ColorPicker extends UI5Element implements IFormInputElement {
}

get colorPickerLabel() {
return ColorPicker.i18nBundle.getText(COLORPICKER_LABEL);
const effectiveLabel = getEffectiveAriaLabelText(this);
return effectiveLabel
? `${ColorPicker.i18nBundle.getText(COLORPICKER_LABEL)} ${effectiveLabel}`
: ColorPicker.i18nBundle.getText(COLORPICKER_LABEL);
}

get sliderGroupLabel() {
Expand Down
4 changes: 2 additions & 2 deletions packages/main/src/ColorPickerTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Button from "./Button.js";

export default function ColorPickerTemplate(this: ColorPicker) {
return (
<section
<div
class="ui5-color-picker-root"
role="group"
aria-label={this.colorPickerLabel}
Expand Down Expand Up @@ -132,6 +132,6 @@ export default function ColorPickerTemplate(this: ColorPicker) {
</div>
</div>
}
</section>
</div>
);
}
Loading