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 <morten.sorvig@qt.io>
This commit is contained in:
Even Oscar Andersen 2025-04-13 11:26:34 +02:00 committed by Morten Johan Sørvig
parent 30fd101b55
commit 53ff8897c5

View File

@ -400,8 +400,11 @@ void QWasmAccessibility::setHtmlElementGeometry(emscripten::val element, QRect g
void QWasmAccessibility::setHtmlElementTextName(QAccessibleInterface *iface)
{
emscripten::val element = ensureHtmlElement(iface);
QString text = iface->text(QAccessible::Name);
element.set("innerHTML", text.toStdString()); // FIXME: use something else than innerHTML
const QString name = iface->text(QAccessible::Name);
if (name.isEmpty())
element.call<void>("removeAttribute", std::string("aria-label"));
else
element.call<void>("setAttribute", std::string("aria-label"), name.toStdString());
}
void QWasmAccessibility::setHtmlElementTextNameLE(QAccessibleInterface *iface) {