From eea5c5fc60b20adf386316b1ddb8eae62f3135c7 Mon Sep 17 00:00:00 2001 From: zepumph Date: Tue, 17 Mar 2020 18:03:07 -0800 Subject: [PATCH] aria-valuetext should appear right after element in a11y view, https://github.com/phetsims/chipper/issues/896 --- gravity-force-lab_a11y_view.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gravity-force-lab_a11y_view.html b/gravity-force-lab_a11y_view.html index 6414bf0d..250b6f05 100644 --- a/gravity-force-lab_a11y_view.html +++ b/gravity-force-lab_a11y_view.html @@ -389,7 +389,9 @@

PDOM & Descriptions for Gravity Force Lab

valueTextElement.className = "pdom-style"; valueTextElement.style.opacity = 0.55; valueTextElement.textContent = element.getAttribute( 'aria-valuetext' ); - element.parentNode.appendChild( valueTextElement ); + + // insert directly after the element that has the valuetext. This handles the case if element is last, see https://stackoverflow.com/questions/4793604/how-to-insert-an-element-after-another-element-in-javascript-without-using-a-lib + element.parentNode.insertBefore( valueTextElement, element.nextSibling ); } } }