diff options
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmaccessibility.cpp')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmaccessibility.cpp | 19 | 
1 files changed, 19 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmaccessibility.cpp b/src/plugins/platforms/wasm/qwasmaccessibility.cpp index 5fa79482217..a87c33c8346 100644 --- a/src/plugins/platforms/wasm/qwasmaccessibility.cpp +++ b/src/plugins/platforms/wasm/qwasmaccessibility.cpp @@ -401,6 +401,7 @@ emscripten::val QWasmAccessibility::createHtmlElement(QAccessibleInterface *ifac          case QAccessible::PageTabList:{              element = document.call<emscripten::val>("createElement", std::string("div"));              setAttribute(element, "role", "tablist"); +            setHtmlElementOrientation(element, iface);              m_elements[iface] = element; @@ -423,6 +424,7 @@ emscripten::val QWasmAccessibility::createHtmlElement(QAccessibleInterface *ifac              element = document.call<emscripten::val>("createElement", std::string("div"));              setAttribute(element, "role", "scrollbar");              setAttribute(element, "aria-valuenow", valueString); +            setHtmlElementOrientation(element, iface);              addEventListener(iface, element, "change");          } break; @@ -437,6 +439,7 @@ emscripten::val QWasmAccessibility::createHtmlElement(QAccessibleInterface *ifac              element = document.call<emscripten::val>("createElement", std::string("div"));              setAttribute(element, "role", "toolbar");              setAttribute(element, "title", text.toStdString()); +            setHtmlElementOrientation(element, iface);              addEventListener(iface, element, "click");          }break;          case QAccessible::MenuItem: @@ -453,6 +456,7 @@ emscripten::val QWasmAccessibility::createHtmlElement(QAccessibleInterface *ifac              element = document.call<emscripten::val>("createElement", std::string("div"));              setAttribute(element, "role", "menubar");              setAttribute(element, "title", text.toStdString()); +            setHtmlElementOrientation(element, iface);              m_elements[iface] = element;              for (int i = 0; i < iface->childCount(); ++i) { @@ -661,6 +665,21 @@ void QWasmAccessibility::setHtmlElementDisabled(QAccessibleInterface *iface)      setAttribute(element, "aria-disabled", iface->state().disabled);  } +void QWasmAccessibility::setHtmlElementOrientation(emscripten::val element, QAccessibleInterface *iface) +{ +    Q_ASSERT(iface); +    if (QAccessibleAttributesInterface *attributesIface = iface->attributesInterface()) { +        const QVariant orientationVariant = +                attributesIface->attributeValue(QAccessible::Attribute::Orientation); +        if (orientationVariant.isValid()) { +            Q_ASSERT(orientationVariant.canConvert<Qt::Orientation>()); +            const Qt::Orientation orientation = orientationVariant.value<Qt::Orientation>(); +            const std::string value = orientation == Qt::Horizontal ? "horizontal" : "vertical"; +            setAttribute(element, "aria-orientation", value); +        } +    } +} +  void QWasmAccessibility::handleStaticTextUpdate(QAccessibleEvent *event)  {      switch (event->type()) {  | 
