summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmcssstyle.cpp
diff options
context:
space:
mode:
authorPiotr Wierciński <[email protected]>2023-03-13 12:53:11 +0100
committerPiotr Wierciński <[email protected]>2023-03-15 09:52:04 +0100
commit1faea46fb6aee440c82b91acb919e7380717ddc0 (patch)
tree89871b20228e5ee5866fefbaef77224c72335f2e /src/plugins/platforms/wasm/qwasmcssstyle.cpp
parent5cea5fc80b9e1b19d620ec6be1acd5cdbd220971 (diff)
Wasm: Hide "Enable screen reader" button in QWasmWindow
For each QWasmWindow, there is "Enable screeen reader" button added for accessibility. It's hidden visually by z-ordering behind main QWasmWindow div. Sometimes the content of QWasmWindow contains transparent elements and the underlying accessibility button gets visible. This commit introduces new CSS class which hides elements visually, but keeps it accessible for screen readers. Fixes: QTBUG-111896 Change-Id: I78ef5746da9e0d1584ee36dd0ca6ba476623a3de Reviewed-by: Mikołaj Boc <[email protected]> Reviewed-by: Morten Johan Sørvig <[email protected]>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmcssstyle.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmcssstyle.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmcssstyle.cpp b/src/plugins/platforms/wasm/qwasmcssstyle.cpp
index 409aad88c73..75b2aafa9a9 100644
--- a/src/plugins/platforms/wasm/qwasmcssstyle.cpp
+++ b/src/plugins/platforms/wasm/qwasmcssstyle.cpp
@@ -208,6 +208,21 @@ const char *Style = R"css(
filter: invert(0.6);
}
+/* This will clip the content within 50% frame in 1x1 pixel area, preventing it
+ from being rendered on the page, but it should still be read by modern
+ screen readers */
+.hidden-visually-read-by-screen-reader {
+ visibility: visible;
+ clip: rect(1px, 1px, 1px, 1px);
+ clip-path: inset(50%);
+ height: 1px;
+ width: 1px;
+ margin: -1px;
+ overflow: hidden;
+ padding: 0;
+ position: absolute;
+}
+
)css";
} // namespace