Skip to content

Commit

Permalink
[JS] Make tabIndex on root card turnoffable (#4020)
Browse files Browse the repository at this point in the history
Fixes #2236
  • Loading branch information
paulcam206 authored May 18, 2020
1 parent 8450bc1 commit 73e1271
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/nodejs/adaptivecards/src/card-elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6117,7 +6117,15 @@ export class AdaptiveCard extends ContainerWithActions {

if (renderedCard) {
renderedCard.classList.add(this.hostConfig.makeCssClassName("ac-adaptiveCard"));
renderedCard.tabIndex = 0;

// Having a tabIndex on the root container for a card can mess up accessibility in some scenarios.
// However, we've shipped this behavior before, and so can't just turn it off in a point release. For
// now, to unblock accessibility scenarios for our customers, we've got an option to turn it off. In a
// future release, we should strongly consider flipping the default such that we *don't* emit a tabIndex
// by default.
if (GlobalSettings.setTabIndexAtCardRoot) {
renderedCard.tabIndex = 0;
}

if (this.speak) {
renderedCard.setAttribute("aria-label", this.speak);
Expand Down
1 change: 1 addition & 0 deletions source/nodejs/adaptivecards/src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class GlobalSettings {
static useBuiltInInputValidation: boolean = true;
static displayInputValidationErrors: boolean = true;
static allowPreProcessingPropertyValues: boolean = false;
static setTabIndexAtCardRoot: boolean = true;
}

export const ContentTypes = {
Expand Down

0 comments on commit 73e1271

Please sign in to comment.