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/ColorPalette.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
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 { getEffectiveAriaLabelText } from "@ui5/webcomponents-base/dist/util/AccessibilityTextsHelper.js";
import ItemNavigation from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js";
import type { ITabbable } from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js";
import ItemNavigationBehavior from "@ui5/webcomponents-base/dist/types/ItemNavigationBehavior.js";
Expand Down Expand Up @@ -132,6 +133,24 @@ class ColorPalette extends UI5Element {
@property()
defaultColor?: string;

/**
* 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 selected color, only valid CSS color values accepted
* @private
Expand Down Expand Up @@ -883,7 +902,10 @@ class ColorPalette extends UI5Element {
}

get colorContainerLabel() {
return ColorPalette.i18nBundle.getText(COLORPALETTE_CONTAINER_LABEL);
const effectiveLabel = getEffectiveAriaLabelText(this);
return effectiveLabel
? `${ColorPalette.i18nBundle.getText(COLORPALETTE_CONTAINER_LABEL)} ${effectiveLabel}`
: ColorPalette.i18nBundle.getText(COLORPALETTE_CONTAINER_LABEL);
}

get colorPaletteMoreColorsText() {
Expand Down
18 changes: 18 additions & 0 deletions packages/main/src/ColorPalettePopover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ class ColorPalettePopover extends UI5Element {
@property()
defaultColor?: string;

/**
* 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 open | closed state of the popover.
* @public
Expand Down
3 changes: 3 additions & 0 deletions packages/main/src/ColorPalettePopoverTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function ColorPalettePopoverTemplate(this: ColorPalettePopover) {
open={this._open}
onClose={this.onAfterClose}
onOpen={this.onAfterOpen}
accessibleName={this._colorPaletteTitle}
>
<div slot="header" class="ui5-cp-header">
<Title level="H1" wrappingType="None">
Expand All @@ -27,6 +28,8 @@ export default function ColorPalettePopoverTemplate(this: ColorPalettePopover) {
showRecentColors={this.showRecentColors}
showDefaultColor={this.showDefaultColor}
defaultColor={this.defaultColor}
accessibleName={this.accessibleName}
accessibleNameRef={this.accessibleNameRef}
popupMode={true}
onItemClick={this.onSelectedColor}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/ColorPaletteTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function ColorPaletteTemplate(this: ColorPalette) {
</div>
}
<div class="ui5-cp-item-container"
role="region"
role="group"
aria-label={this.colorContainerLabel}
onKeyDown={this._onColorContainerKeyDown}
>
Expand Down
Loading