Skip to content

Commit

Permalink
[JS] Make tabIndex on root card turnoffable (#4020) (#4068)
Browse files Browse the repository at this point in the history
Fixes #2236 in release/1.2
Original commit 73e1271
Original PR #4020
  • Loading branch information
paulcam206 authored May 29, 2020
1 parent 382fcc9 commit 9e14155
Show file tree
Hide file tree
Showing 2 changed files with 13 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 @@ -6866,7 +6866,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 (Shared.GlobalSettings.setTabIndexAtCardRoot) {
renderedCard.tabIndex = 0;
}

if (!Utils.isNullOrEmpty(this.speak)) {
renderedCard.setAttribute("aria-label", this.speak);
Expand Down
4 changes: 4 additions & 0 deletions source/nodejs/adaptivecards/src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// Licensed under the MIT License.
import * as Enums from "./enums";

export class GlobalSettings {
static setTabIndexAtCardRoot: boolean = true;
}

export const ContentTypes = {
applicationJson: "application/json",
applicationXWwwFormUrlencoded: "application/x-www-form-urlencoded"
Expand Down

0 comments on commit 9e14155

Please sign in to comment.