Split shared UI knowledge into atomic topic directories
This commit is contained in:
1 parent
08ff987edb
commit
b0e6402d66
37 files changed
+600
-516
No files matched your search
@@ -0,0 +1,44 @@
|
||||
# Screen-sharing mask with explicit markers
|
||||
|
||||
Mark sensitive text when rendering, including partial updates; this avoids recognizing money
|
||||
with regexes or guessing columns from translated captions. Keep headings outside the mask.
|
||||
The mask preserves dimensions. Use text-only spans for this minimal example.
|
||||
|
||||
```html
|
||||
<button id="privacy-toggle" type="button" aria-pressed="false">Hide amounts</button>
|
||||
<span data-sensitive>$13 320</span>
|
||||
```
|
||||
|
||||
```css
|
||||
body.prices-hidden [data-sensitive] {
|
||||
color: transparent;
|
||||
background: black;
|
||||
border-radius: 2px;
|
||||
user-select: none;
|
||||
}
|
||||
```
|
||||
|
||||
Load the following script after the button. Existing and future marked spans follow the body
|
||||
class, so no DOM-walking observer is needed. The example falls back to the current page if
|
||||
the browser does not allow local storage.
|
||||
|
||||
```js
|
||||
const privacyButton = document.getElementById('privacy-toggle');
|
||||
const privacyKey = 'example.ui.hide-amounts';
|
||||
function setPrivacy(hidden) {
|
||||
document.body.classList.toggle('prices-hidden', hidden);
|
||||
privacyButton.setAttribute('aria-pressed', String(hidden));
|
||||
privacyButton.textContent = hidden ? 'Show amounts' : 'Hide amounts';
|
||||
try { localStorage.setItem(privacyKey, String(hidden)); } catch { /* Page-only preference. */ }
|
||||
}
|
||||
let initiallyHidden = false;
|
||||
try { initiallyHidden = localStorage.getItem(privacyKey) === 'true'; } catch { /* Use default. */ }
|
||||
setPrivacy(initiallyHidden);
|
||||
privacyButton.addEventListener('click', () => {
|
||||
setPrivacy(!document.body.classList.contains('prices-hidden'));
|
||||
});
|
||||
```
|
||||
|
||||
This is cosmetic masking for a display, not security or export redaction. The underlying text
|
||||
remains available in the DOM and to assistive technology. Applications choose which values to
|
||||
mark; stok additionally masks selected project and purchase identifiers.
|
||||
@@ -0,0 +1,10 @@
|
||||
# Contract: Display Privacy
|
||||
|
||||
Part of [web-visual-baseline](../contract.md).
|
||||
|
||||
- Optional screen-sharing privacy mode masks sensitive values in place, preserves column
|
||||
geometry and headings, and uses a labeled toggle with `aria-pressed`. Persist the preference
|
||||
locally and apply it to newly rendered values. This is display masking only: DOM values,
|
||||
API responses and exports are not redacted or access-controlled by it.
|
||||
|
||||
See the [implementation example](README.md).
|
||||
Reference in new issue
Block a user