diff --git a/sun_a11y_view.html b/sun_a11y_view.html index 59704c46..78e71a05 100644 --- a/sun_a11y_view.html +++ b/sun_a11y_view.html @@ -389,7 +389,9 @@

PDOM & Descriptions for sun demo

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 ); } } }