openvibers/openvibe.live Commits
Copying a rolling number copies the number (#713)
Changes
@@@ -26,6 +26,7 @@not the line box, and digits overflow it. */.ovnum{--ovnum-h:1.25em;display:inline-flex;align-items:center;line-height:var(--ovnum-h);font-variant-numeric:tabular-nums}.ovnum-cell{display:inline-block;line-height:var(--ovnum-h)}++.ovnum-digit,.ovnum-cell{-webkit-user-select:none;user-select:none}.ovnum-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}.ovnum-digit{display:inline-block;overflow:hidden;height:var(--ovnum-h);width:1ch;position:relative}.ovnum-track{display:block;transition:transform var(--ovnum-dur,.62s) cubic-bezier(.22,1,.28,1)}@@@ -49,4 +49,6 @@ assert.strictEqual(el.querySelectorAll('.ovnum-sr').length, 1, 'still one copy aconst src = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'ov-odometer.js'), 'utf8');assert.ok(/\.ovnum-sr\{position:absolute;width:1px;height:1px;[^}]*clip-path:inset\(50%\)/.test(src), 'the copy is visually hidden, not display:none');++// Copy: aria-hidden does not stop a selection, so the strips and cells cannot be selected; the hidden copy can.++assert.ok(/\.ovnum-digit,\.ovnum-cell\{-webkit-user-select:none;user-select:none\}/.test(src), 'copying a counter copies the number, not the strips');console.log('odometer: screen readers and copy get the number; the rolling strips are hidden from them');
@@ -26,6 +26,7 @@
@@ -26,6 +26,7 @@
not the line box, and digits overflow it. */
not the line box, and digits overflow it. */
.ovnum{--ovnum-h:1.25em;display:inline-flex;align-items:center;line-height:var(--ovnum-h);font-variant-numeric:tabular-nums}
.ovnum{--ovnum-h:1.25em;display:inline-flex;align-items:center;line-height:var(--ovnum-h);font-variant-numeric:tabular-nums}
.ovnum-cell{display:inline-block;line-height:var(--ovnum-h)}
.ovnum-cell{display:inline-block;line-height:var(--ovnum-h)}
+.ovnum-digit,.ovnum-cell{-webkit-user-select:none;user-select:none}
.ovnum-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
.ovnum-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}
.ovnum-digit{display:inline-block;overflow:hidden;height:var(--ovnum-h);width:1ch;position:relative}
.ovnum-digit{display:inline-block;overflow:hidden;height:var(--ovnum-h);width:1ch;position:relative}
.ovnum-track{display:block;transition:transform var(--ovnum-dur,.62s) cubic-bezier(.22,1,.28,1)}
.ovnum-track{display:block;transition:transform var(--ovnum-dur,.62s) cubic-bezier(.22,1,.28,1)}
@@ -49,4 +49,6 @@ assert.strictEqual(el.querySelectorAll('.ovnum-sr').length, 1, 'still one copy a
@@ -49,4 +49,6 @@ assert.strictEqual(el.querySelectorAll('.ovnum-sr').length, 1, 'still one copy a
const src = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'ov-odometer.js'), 'utf8');
const src = fs.readFileSync(path.join(__dirname, '..', 'public', 'js', 'ov-odometer.js'), 'utf8');
assert.ok(/\.ovnum-sr\{position:absolute;width:1px;height:1px;[^}]*clip-path:inset\(50%\)/.test(src), 'the copy is visually hidden, not display:none');
assert.ok(/\.ovnum-sr\{position:absolute;width:1px;height:1px;[^}]*clip-path:inset\(50%\)/.test(src), 'the copy is visually hidden, not display:none');
+// Copy: aria-hidden does not stop a selection, so the strips and cells cannot be selected; the hidden copy can.
+assert.ok(/\.ovnum-digit,\.ovnum-cell\{-webkit-user-select:none;user-select:none\}/.test(src), 'copying a counter copies the number, not the strips');
console.log('odometer: screen readers and copy get the number; the rolling strips are hidden from them');
console.log('odometer: screen readers and copy get the number; the rolling strips are hidden from them');