diff --git a/source/nodejs/adaptivecards-designer/src/designer-peers.ts b/source/nodejs/adaptivecards-designer/src/designer-peers.ts index e37028b493..8ae04a6339 100644 --- a/source/nodejs/adaptivecards-designer/src/designer-peers.ts +++ b/source/nodejs/adaptivecards-designer/src/designer-peers.ts @@ -292,7 +292,7 @@ export abstract class SingleInputPropertyEditor extends PropertySheetEntry { let action = new Adaptive.SubmitAction(); action.id = command.id; action.title = command.caption; - action.description = command.altText; + action.accessibleTitle = command.altText; action.expanded = command.expanded; action.onExecute = (sender: Adaptive.Action) => { command.onExecute(this, sender.renderedElement); }; @@ -822,7 +822,7 @@ class NameValuePairPropertyEditor extends PropertySheetEntry { let removeAction = new Adaptive.SubmitAction(); removeAction.title = "X"; - removeAction.description = "Remove"; + removeAction.accessibleTitle = "Remove"; removeAction.onExecute = (sender) => { nameValuePairs.splice(i, 1); diff --git a/source/nodejs/adaptivecards/src/card-elements.ts b/source/nodejs/adaptivecards/src/card-elements.ts index e0a2c6ca00..179ded0087 100644 --- a/source/nodejs/adaptivecards/src/card-elements.ts +++ b/source/nodejs/adaptivecards/src/card-elements.ts @@ -917,7 +917,12 @@ export class TextBlock extends BaseTextBlock { if (this.style === "heading") { element.setAttribute("role", "heading"); - element.setAttribute("aria-level", GlobalSettings.defaultHeadingLevel.toString()); + + let headingLevel = this.hostConfig.headings.level; + + if (headingLevel !== undefined) { + element.setAttribute("aria-level", headingLevel.toString()); + } } if (this.selectAction && hostConfig.supportsInteractivity) { @@ -3874,6 +3879,7 @@ export abstract class Action extends CardObject { raiseExecuteActionEvent(this); } + accessibleTitle?: string; expanded?: boolean; onExecute: (sender: Action) => void; @@ -3914,7 +3920,11 @@ export abstract class Action extends CardObject { this.addCssClasses(buttonElement); - if (this.effectiveTooltip) { + if (this.accessibleTitle) { + buttonElement.setAttribute("aria-label", this.accessibleTitle); + buttonElement.title = this.accessibleTitle; + } + else if (this.effectiveTooltip) { buttonElement.setAttribute("aria-label", this.effectiveTooltip); buttonElement.title = this.effectiveTooltip; } diff --git a/source/nodejs/adaptivecards/src/host-config.ts b/source/nodejs/adaptivecards/src/host-config.ts index 95a3b7a8ce..0f47102b9b 100644 --- a/source/nodejs/adaptivecards/src/host-config.ts +++ b/source/nodejs/adaptivecards/src/host-config.ts @@ -229,6 +229,16 @@ export class FactSetConfig { } } +export class HeadingsConfig { + level?: number; + + constructor(obj?: any) { + if (obj) { + this.level = obj.level !== undefined && obj.level !== null && typeof obj.level === "number" ? obj.level : this.level; + } + } +} + export class ShowCardActionConfig { actionMode: Enums.ShowCardActionMode = Enums.ShowCardActionMode.Inline; inlineTopMargin: number = 16; @@ -586,6 +596,7 @@ export class HostConfig { readonly imageSet: ImageSetConfig = new ImageSetConfig(); readonly media: MediaConfig = new MediaConfig(); readonly factSet: FactSetConfig = new FactSetConfig(); + readonly headings: HeadingsConfig = new HeadingsConfig(); cssClassNamePrefix?: string; alwaysAllowBleed: boolean = false; diff --git a/source/nodejs/adaptivecards/src/shared.ts b/source/nodejs/adaptivecards/src/shared.ts index 038bd27aa6..26e220c676 100644 --- a/source/nodejs/adaptivecards/src/shared.ts +++ b/source/nodejs/adaptivecards/src/shared.ts @@ -33,7 +33,6 @@ export class GlobalSettings { static enableFallback: boolean = true; static useWebkitLineClamp: boolean = true; static allowMoreThanMaxActionsInOverflowMenu: boolean = false; - static defaultHeadingLevel: number = 2; static readonly applets: AppletsSettings = { logEnabled: true,