Skip to content

Commit 53ff889

Browse files
EvenOAndersenMorten Johan Sørvig
authored andcommitted
wasm: a11y - Use aria-label for QAccessible::Name
innerHTML does not work too well with type input. Instead use attribute 'aria-label' Task-number: QTBUG-135590 Change-Id: Ibec36a133c650bb51b1f1a84580a5ce35531c137 Reviewed-by: Morten Johan Sørvig <[email protected]>
1 parent 30fd101 commit 53ff889

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/plugins/platforms/wasm/qwasmaccessibility.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,11 @@ void QWasmAccessibility::setHtmlElementGeometry(emscripten::val element, QRect g
400400
void QWasmAccessibility::setHtmlElementTextName(QAccessibleInterface *iface)
401401
{
402402
emscripten::val element = ensureHtmlElement(iface);
403-
QString text = iface->text(QAccessible::Name);
404-
element.set("innerHTML", text.toStdString()); // FIXME: use something else than innerHTML
403+
const QString name = iface->text(QAccessible::Name);
404+
if (name.isEmpty())
405+
element.call<void>("removeAttribute", std::string("aria-label"));
406+
else
407+
element.call<void>("setAttribute", std::string("aria-label"), name.toStdString());
405408
}
406409

407410
void QWasmAccessibility::setHtmlElementTextNameLE(QAccessibleInterface *iface) {

0 commit comments

Comments
 (0)