From 7975ebfe4e718d819d8a473fb01d6935110167c1 Mon Sep 17 00:00:00 2001 From: Robert Wagner Date: Fri, 21 Jun 2019 15:01:48 -0400 Subject: [PATCH] Add aria-describedby and aria-labeledby --- src/js/step.js | 21 ++++++++++++++++----- test/unit/step.spec.js | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/src/js/step.js b/src/js/step.js index 7d4247ba5..6d8fb2198 100644 --- a/src/js/step.js +++ b/src/js/step.js @@ -184,9 +184,15 @@ export class Step extends Evented { * * @private * @param {HTMLElement} content The content to append the text to + * @param {string} descriptionId The id to set on the shepherd-text element + * for the parent element to use for aria-describedby */ - _addContent(content) { - const text = createFromHTML('
'); + _addContent(content, descriptionId) { + const text = createFromHTML( + `
` + ); let paragraphs = this.options.text; if (isFunction(paragraphs)) { @@ -271,9 +277,11 @@ export class Step extends Evented { _createTooltipContent() { const content = document.createElement('div'); const classes = this.options.classes || ''; + const descriptionId = `${this.id}-description`; + const labelId = `${this.id}-label`; const element = createFromHTML( - `