सुलभता पैटर्न · डिस्क्लोज़र और सामग्री
और दिखाएँ
aria-expanded वाला एक असली बटन बाक़ी टेक्स्ट दिखाता या छिपाता है, और फ़ोकस बटन पर ही रहता है। छिपा हिस्सा बटन के ठीक बाद आता है और hidden="until-found" इस्तेमाल करता है, इसलिए पेज में खोज तब भी हर शब्द तक पहुँचती है।
- डब्ल्यूसीएजी मानदंड
- 6
- कीबोर्ड नियम
- 2
- जाँच का तरीक़ा
- axe, कीबोर्ड और इंस्पेक्टर
लाइव डेमो
आज़माएँ
इसे माउस, कीबोर्ड या स्क्रीन रीडर से इस्तेमाल करें। साथ का इंस्पेक्टर दिखाता है कि आपके इस्तेमाल के दौरान ब्राउज़र सहायक तकनीक को क्या बताता है: फ़ोकस, स्थिति में बदलाव और घोषणाएँ।
वाराणसी में हाथ से बुनी
बनारसी रेशमी साड़ी, मोरपंखी नीली
₹18,400
गड्ढा करघे पर हाथ से बुनी इस साड़ी में छोटे सुनहरे बूटों से सजा मोरपंखी नीला तन और चौड़ा ज़री का बॉर्डर है। यह मुलायम ढंग से लिपटती है और लंबे दिन भर अपनी प्लीट्स बनाए रखती है।
हर साड़ी पर एक बुनकर को लगभग तीन हफ़्ते लगते हैं। बुनाई में छोटे-छोटे फ़र्क़ हथकरघे की पहचान हैं, कमियाँ नहीं।
- कपड़ा
- ज़री के साथ कतान सिल्क
- लंबाई
- 5.5 मीटर, साथ में 0.8 मीटर का ब्लाउज़ पीस
- वज़न
- लगभग 650 ग्राम
देखभाल और रखरखाव
सिर्फ़ ड्राई क्लीन करें। इसे मलमल में तह करके, नमी से दूर रखें, और हर कुछ महीनों में नई लकीरों पर फिर से तह करें ताकि ज़री न चटके।
जावास्क्रिप्ट के बिना डेमो उतना ही काम करता है जितना उसका एचटीएमएल; इंस्पेक्टर के लिए जावास्क्रिप्ट चाहिए।
कीबोर्ड
जिन कुंजियों पर यह काम करता है
हर क्रिया पॉइंटर के बिना काम करती है।
| कुंजी | यह क्या करती है |
|---|---|
| Tab | 'इस साड़ी के बारे में और' से 'देखभाल और रखरखाव' पर ले जाता है; खुले टेक्स्ट में कोई लिंक होता तो वह बीच में आता। |
| EnterयाSpace | फ़ोकस वाला बटन या summary जिस टेक्स्ट को नियंत्रित करता है, उसे दिखाता या छिपाता है; फ़ोकस अपनी जगह पर रहता है। |
स्क्रीन रीडर
यह क्या घोषित करता है
मार्कअप की भूमिकाओं, नामों और स्थितियों से लिखा गया।
| कब | अपेक्षित घोषणा |
|---|---|
| फ़ोकस बटन पर पहुँचता है | इस साड़ी के बारे में और, बटन, संकुचित |
| Enter बाक़ी हिस्सा दिखाता है | विस्तारित |
| बटन से आगे पढ़ने पर | हर साड़ी पर एक बुनकर को लगभग तीन हफ़्ते लगते हैं… |
| फ़ोकस details के summary पर पहुँचता है | देखभाल और रखरखाव, बटन, संकुचित |
| पेज में खोज छिपा टेक्स्ट ढूँढ लेती है | टेक्स्ट दिख जाता है और बटन विस्तारित बताता है |
ये अपेक्षित घोषणाएँ हैं, रिकॉर्डिंग नहीं। स्क्रीन रीडर और ब्राउज़र के हिसाब से शब्द और क्रम बदलते हैं।
कोड
कोड कॉपी करें
वही फ़ाइलें जिन पर यह डेमो चलता है। स्टाइल एक प्रीफ़िक्स के साथ परोसी जाती हैं जो इस साइट की अपनी स्टाइल को डेमो से दूर रखता है; आप जो कॉपी करते हैं वह मूल है।
<div class="ap-disclosure" data-ap-disclosure>
<div class="ap-disclosure__layout">
<div class="ap-disclosure__swatch" aria-hidden="true">
<svg viewBox="0 0 200 200" preserveAspectRatio="xMidYMax slice" focusable="false">
<defs>
<pattern id="disc-butti" width="40" height="36" patternUnits="userSpaceOnUse">
<path class="ap-disclosure__butti" d="M20 10l5 8-5 8-5-8ZM0-8l5 8-5 8-5-8ZM40-8l5 8-5 8-5-8ZM0 28l5 8-5 8-5-8ZM40 28l5 8-5 8-5-8Z"/>
</pattern>
<pattern id="disc-zari" width="14" height="42" patternUnits="userSpaceOnUse">
<path class="ap-disclosure__zari-line" d="M0 25l7-8 7 8"/>
</pattern>
</defs>
<rect class="ap-disclosure__silk" width="200" height="200"/>
<rect width="200" height="136" fill="url(#disc-butti)"/>
<rect class="ap-disclosure__zari" y="158" width="200" height="42"/>
<rect y="158" width="200" height="42" fill="url(#disc-zari)"/>
<path class="ap-disclosure__zari-line" d="M0 164h200M0 194h200"/>
</svg>
</div>
<div class="ap-disclosure__body">
<p class="ap-disclosure__kicker">Handwoven in Varanasi</p>
<h3 class="ap-disclosure__name">Banarasi silk saree, peacock blue</h3>
<p class="ap-disclosure__price">₹18,400</p>
<p class="ap-disclosure__intro">Woven by hand on a pit loom, this saree pairs a peacock-blue body, scattered with small gold motifs, with a broad zari border. It drapes softly and holds its pleats through a long day.</p>
<button type="button" class="ap-disclosure__toggle" aria-expanded="false" aria-controls="disc-more">
<span>More about this saree</span>
<svg class="ap-disclosure__chev" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m6 9 6 6 6-6"/></svg>
</button>
<div class="ap-disclosure__more" id="disc-more" hidden="until-found">
<div class="ap-disclosure__more-in">
<p>Each saree takes one weaver about three weeks. Small changes in the weave are the mark of a handloom, not flaws.</p>
<dl class="ap-disclosure__facts">
<div><dt>Fabric</dt><dd>Katan silk with zari</dd></div>
<div><dt>Length</dt><dd>5.5 m, with a 0.8 m blouse piece</dd></div>
<div><dt>Weight</dt><dd>About 650 g</dd></div>
</dl>
</div>
</div>
<details class="ap-disclosure__details">
<summary class="ap-disclosure__summary">
<span>Care and storage</span>
<svg class="ap-disclosure__chev" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m6 9 6 6 6-6"/></svg>
</summary>
<div class="ap-disclosure__details-in">
<p>Dry clean only. Store it folded in muslin, away from damp, and refold it along new lines every few months so the zari does not crack.</p>
</div>
</details>
</div>
</div>
</div>
/* Show more (disclosure). Uses the --ap-* design tokens. */
.ap-disclosure {
container-type: inline-size;
width: min(100%, 640px);
margin-inline: auto;
border: 1px solid var(--ap-border);
border-radius: var(--ap-radius-lg);
background: var(--ap-surface);
color: var(--ap-text);
box-shadow: var(--ap-shadow-md);
overflow: hidden;
}
.ap-disclosure__layout {
display: grid;
grid-template-columns: minmax(0, 1fr);
}
/* The fabric swatch is decoration: aria-hidden, drawn with SVG. A band on
top in a narrow card, a full-height strip beside the text in a wide one. */
.ap-disclosure__swatch {
height: 104px;
background: var(--ap-accent);
}
@container (min-width: 540px) {
.ap-disclosure__layout {
grid-template-columns: 176px minmax(0, 1fr);
}
.ap-disclosure__swatch {
height: auto;
}
}
.ap-disclosure__swatch svg {
display: block;
width: 100%;
height: 100%;
}
.ap-disclosure__silk { fill: var(--ap-accent); }
.ap-disclosure__butti {
fill: var(--ap-warning);
opacity: .85;
}
.ap-disclosure__zari { fill: var(--ap-warning); }
.ap-disclosure__zari-line {
fill: none;
stroke: var(--ap-surface);
stroke-width: 1.5;
opacity: .55;
}
.ap-disclosure__body {
display: grid;
align-content: start;
padding: 22px 24px 24px;
}
.ap-disclosure__kicker {
margin: 0 0 4px;
color: var(--ap-text-3);
font-size: .8125rem;
font-weight: 600;
letter-spacing: .04em;
text-transform: uppercase;
}
.ap-disclosure__name {
margin: 0;
font-size: 1.25rem;
font-weight: 650;
line-height: 1.3;
}
.ap-disclosure__price {
margin: 6px 0 0;
color: var(--ap-text);
font-size: 1.0625rem;
font-weight: 600;
font-variant-numeric: tabular-nums;
}
.ap-disclosure__intro,
.ap-disclosure__more-in p,
.ap-disclosure__details-in p {
margin: 0;
color: var(--ap-text-2);
line-height: 1.65;
}
.ap-disclosure__intro {
margin-top: 16px;
}
/* The button sits between the summary and the rest, like a rule. */
.ap-disclosure__toggle {
display: inline-flex;
align-items: center;
justify-self: start;
gap: 6px;
min-height: var(--ap-target);
margin: 6px 0 0 -10px;
padding: 0 10px;
border: 0;
border-radius: var(--ap-radius-sm);
background: transparent;
color: var(--ap-accent-text);
font: inherit;
font-weight: 600;
cursor: pointer;
transition: background-color var(--ap-duration) var(--ap-ease);
}
.ap-disclosure__toggle:hover {
background: var(--ap-accent-soft);
color: var(--ap-accent-soft-text);
}
.ap-disclosure__toggle:focus-visible {
outline: 2px solid var(--ap-focus);
outline-offset: 0;
}
.ap-disclosure__chev {
flex-shrink: 0;
width: 18px;
height: 18px;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
transition: transform var(--ap-duration) var(--ap-ease);
}
.ap-disclosure__toggle[aria-expanded="true"] .ap-disclosure__chev,
.ap-disclosure__details[open] .ap-disclosure__chev {
transform: rotate(180deg);
}
/* Many resets set [hidden] { display: none !important }, which makes
until-found plain hidden again and find-in-page stops reaching the text.
Keep the panel findable; it has no padding or border of its own, so it
takes no space while collapsed. */
.ap-disclosure__more[hidden="until-found"] {
display: block !important;
content-visibility: hidden !important;
}
.ap-disclosure__more:not([hidden]) {
animation: ap-disclosure-in 200ms var(--ap-ease);
}
.ap-disclosure__more-in {
display: grid;
gap: 14px;
padding: 4px 0 2px;
}
.ap-disclosure__facts {
display: grid;
margin: 0;
border-top: 1px solid var(--ap-border);
}
.ap-disclosure__facts div {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 4px 16px;
padding: 9px 0;
border-bottom: 1px solid var(--ap-border);
}
.ap-disclosure__facts dt {
color: var(--ap-text-3);
}
.ap-disclosure__facts dd {
margin: 0;
color: var(--ap-text);
font-weight: 600;
text-align: end;
}
/* The native version. */
.ap-disclosure__details {
margin-top: 18px;
border: 1px solid var(--ap-border);
border-radius: var(--ap-radius);
background: var(--ap-surface);
}
.ap-disclosure__summary {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-height: var(--ap-target);
padding: 10px 14px;
border-radius: calc(var(--ap-radius) - 1px);
color: var(--ap-text);
font-weight: 600;
list-style: none;
cursor: pointer;
transition: background-color var(--ap-duration) var(--ap-ease);
}
.ap-disclosure__summary::-webkit-details-marker {
display: none;
}
.ap-disclosure__summary:hover {
background: var(--ap-surface-2);
}
.ap-disclosure__summary:focus-visible {
outline: 2px solid var(--ap-focus);
outline-offset: 2px;
}
.ap-disclosure__summary .ap-disclosure__chev {
color: var(--ap-text-3);
}
.ap-disclosure__details[open] .ap-disclosure__summary {
border-bottom: 1px solid var(--ap-border);
border-radius: calc(var(--ap-radius) - 1px) calc(var(--ap-radius) - 1px) 0 0;
}
.ap-disclosure__details-in {
padding: 12px 14px 14px;
}
.ap-disclosure__details[open] .ap-disclosure__details-in {
animation: ap-disclosure-in 200ms var(--ap-ease);
}
@keyframes ap-disclosure-in {
from { opacity: 0; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
.ap-disclosure__toggle,
.ap-disclosure__summary,
.ap-disclosure__chev { transition: none; }
.ap-disclosure__more:not([hidden]),
.ap-disclosure__details[open] .ap-disclosure__details-in { animation: none; }
}
/**
* Show more (disclosure): a button that shows or hides the text after it.
*
* Markup: [data-ap-disclosure] holding button[aria-expanded][aria-controls]
* and the element it controls, div[hidden="until-found"]. The details
* element beside it needs no script.
*/
export function init(root) {
const buttons = [...root.querySelectorAll("button[aria-expanded][aria-controls]")];
const panelOf = (button) => document.getElementById(button.getAttribute("aria-controls"));
function setOpen(button, open) {
button.setAttribute("aria-expanded", String(open));
const panel = panelOf(button);
if (open) panel.removeAttribute("hidden");
else panel.setAttribute("hidden", "until-found");
}
// Focus stays on the button: people asked for more and read on from here.
function onClick(event) {
const button = event.target.closest("button[aria-expanded][aria-controls]");
if (button && buttons.includes(button)) setOpen(button, button.getAttribute("aria-expanded") !== "true");
}
// Find-in-page matched hidden text: the browser reveals it, and the button
// has to say so too.
function onBeforeMatch(event) {
const button = buttons.find((b) => panelOf(b) === event.target);
if (button) button.setAttribute("aria-expanded", "true");
}
root.addEventListener("click", onClick);
root.addEventListener("beforematch", onBeforeMatch);
return () => {
root.removeEventListener("click", onClick);
root.removeEventListener("beforematch", onBeforeMatch);
};
}
for (const root of document.querySelectorAll("[data-ap-disclosure]")) init(root);
/* Design tokens for the pattern components. Light by default, dark when the
system asks for it; set data-theme="dark" on :root to force dark. */
:root {
--ap-radius-sm: 8px;
--ap-radius: 12px;
--ap-radius-lg: 16px;
--ap-radius-full: 999px;
--ap-font: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--ap-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
--ap-ease: cubic-bezier(.2, .8, .2, 1);
--ap-duration: 180ms;
--ap-target: 44px;
--ap-bg: #F4F4F5;
--ap-surface: #FFFFFF;
--ap-surface-2: #F4F4F5;
--ap-surface-3: #E4E4E7;
--ap-border: #E4E4E7;
--ap-border-strong: #76767F;
--ap-text: #18181B;
--ap-text-2: #3F3F46;
--ap-text-3: #5E5E66;
--ap-accent: #4F46E5;
--ap-accent-hover: #4338CA;
--ap-on-accent: #FFFFFF;
--ap-accent-text: #4338CA;
--ap-accent-soft: #EEF2FF;
--ap-accent-soft-text: #3730A3;
--ap-focus: #4F46E5;
--ap-danger: #B91C1C;
--ap-danger-soft: #FEF2F2;
--ap-success: #15803D;
--ap-success-soft: #F0FDF4;
--ap-warning: #A15C07;
--ap-warning-soft: #FEFCE8;
--ap-info: #1D4ED8;
--ap-info-soft: #EFF6FF;
--ap-scrim: rgb(9 9 11 / .48);
--ap-shadow-sm: 0 1px 2px rgb(9 9 11 / .06);
--ap-shadow-md: 0 1px 2px rgb(9 9 11 / .05), 0 6px 16px -4px rgb(9 9 11 / .1);
--ap-shadow-lg: 0 2px 6px rgb(9 9 11 / .06), 0 20px 40px -12px rgb(9 9 11 / .22);
--ap-light-bg: #F4F4F5;
--ap-light-surface: #FFFFFF;
--ap-light-surface-2: #F4F4F5;
--ap-light-surface-3: #E4E4E7;
--ap-light-border: #E4E4E7;
--ap-light-border-strong: #76767F;
--ap-light-text: #18181B;
--ap-light-text-2: #3F3F46;
--ap-light-text-3: #5E5E66;
--ap-light-accent: #4F46E5;
--ap-light-accent-hover: #4338CA;
--ap-light-on-accent: #FFFFFF;
--ap-light-accent-text: #4338CA;
--ap-light-accent-soft: #EEF2FF;
--ap-light-accent-soft-text: #3730A3;
--ap-light-focus: #4F46E5;
--ap-light-danger: #B91C1C;
--ap-light-danger-soft: #FEF2F2;
--ap-light-success: #15803D;
--ap-light-success-soft: #F0FDF4;
--ap-light-warning: #A15C07;
--ap-light-warning-soft: #FEFCE8;
--ap-light-info: #1D4ED8;
--ap-light-info-soft: #EFF6FF;
--ap-light-scrim: rgb(9 9 11 / .48);
--ap-light-shadow-sm: 0 1px 2px rgb(9 9 11 / .06);
--ap-light-shadow-md: 0 1px 2px rgb(9 9 11 / .05), 0 6px 16px -4px rgb(9 9 11 / .1);
--ap-light-shadow-lg: 0 2px 6px rgb(9 9 11 / .06), 0 20px 40px -12px rgb(9 9 11 / .22);
--ap-dark-bg: #09090B;
--ap-dark-surface: #18181B;
--ap-dark-surface-2: #27272A;
--ap-dark-surface-3: #3F3F46;
--ap-dark-border: #2E2E33;
--ap-dark-border-strong: #8E8E97;
--ap-dark-text: #FAFAFA;
--ap-dark-text-2: #D4D4D8;
--ap-dark-text-3: #A1A1AA;
--ap-dark-accent: #818CF8;
--ap-dark-accent-hover: #A5B4FC;
--ap-dark-on-accent: #0C0A1F;
--ap-dark-accent-text: #A5B4FC;
--ap-dark-accent-soft: #1E1B4B;
--ap-dark-accent-soft-text: #C7D2FE;
--ap-dark-focus: #A5B4FC;
--ap-dark-danger: #F87171;
--ap-dark-danger-soft: #2A1215;
--ap-dark-success: #4ADE80;
--ap-dark-success-soft: #0F2A1A;
--ap-dark-warning: #FACC15;
--ap-dark-warning-soft: #2A2410;
--ap-dark-info: #60A5FA;
--ap-dark-info-soft: #0F1D33;
--ap-dark-scrim: rgb(0 0 0 / .62);
--ap-dark-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
--ap-dark-shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .5);
--ap-dark-shadow-lg: 0 2px 8px rgb(0 0 0 / .45), 0 24px 48px -12px rgb(0 0 0 / .7);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--ap-bg: #09090B;
--ap-surface: #18181B;
--ap-surface-2: #27272A;
--ap-surface-3: #3F3F46;
--ap-border: #2E2E33;
--ap-border-strong: #8E8E97;
--ap-text: #FAFAFA;
--ap-text-2: #D4D4D8;
--ap-text-3: #A1A1AA;
--ap-accent: #818CF8;
--ap-accent-hover: #A5B4FC;
--ap-on-accent: #0C0A1F;
--ap-accent-text: #A5B4FC;
--ap-accent-soft: #1E1B4B;
--ap-accent-soft-text: #C7D2FE;
--ap-focus: #A5B4FC;
--ap-danger: #F87171;
--ap-danger-soft: #2A1215;
--ap-success: #4ADE80;
--ap-success-soft: #0F2A1A;
--ap-warning: #FACC15;
--ap-warning-soft: #2A2410;
--ap-info: #60A5FA;
--ap-info-soft: #0F1D33;
--ap-scrim: rgb(0 0 0 / .62);
--ap-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
--ap-shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .5);
--ap-shadow-lg: 0 2px 8px rgb(0 0 0 / .45), 0 24px 48px -12px rgb(0 0 0 / .7);
}
}
:root[data-theme="dark"] {
--ap-bg: #09090B;
--ap-surface: #18181B;
--ap-surface-2: #27272A;
--ap-surface-3: #3F3F46;
--ap-border: #2E2E33;
--ap-border-strong: #8E8E97;
--ap-text: #FAFAFA;
--ap-text-2: #D4D4D8;
--ap-text-3: #A1A1AA;
--ap-accent: #818CF8;
--ap-accent-hover: #A5B4FC;
--ap-on-accent: #0C0A1F;
--ap-accent-text: #A5B4FC;
--ap-accent-soft: #1E1B4B;
--ap-accent-soft-text: #C7D2FE;
--ap-focus: #A5B4FC;
--ap-danger: #F87171;
--ap-danger-soft: #2A1215;
--ap-success: #4ADE80;
--ap-success-soft: #0F2A1A;
--ap-warning: #FACC15;
--ap-warning-soft: #2A2410;
--ap-info: #60A5FA;
--ap-info-soft: #0F1D33;
--ap-scrim: rgb(0 0 0 / .62);
--ap-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
--ap-shadow-md: 0 1px 2px rgb(0 0 0 / .4), 0 8px 20px -6px rgb(0 0 0 / .5);
--ap-shadow-lg: 0 2px 8px rgb(0 0 0 / .45), 0 24px 48px -12px rgb(0 0 0 / .7);
}
डब्ल्यूसीएजी 2.2
यह किन मानदंडों को पूरा करता है
वे सफलता मानदंड जिनका यह पैटर्न ध्यान रखता है, और कैसे।
-
1.3.2 सार्थक क्रम
स्तर A
खुलने वाला टेक्स्ट सोर्स में बटन के ठीक बाद आता है, इसलिए बटन से आगे पढ़ने पर सबसे पहले वही मिलता है।
-
2.1.1 कीबोर्ड
स्तर A
दोनों संस्करण Enter या Space से खुलते और बंद होते हैं; कुछ भी पॉइंटर पर निर्भर नहीं।
-
2.4.3 फ़ोकस क्रम
स्तर A
टेक्स्ट खुलने पर फ़ोकस बटन पर रहता है, और अगला Tab खुले हिस्से में जाता है।
-
2.4.7 फ़ोकस दिखाई देना
स्तर AA
बटन और summary दो पिक्सेल की फ़ोकस रिंग दिखाते हैं, जो कार्ड के मुक़ाबले 3:1 से ऊपर है।
-
2.5.8 टारगेट साइज़ (न्यूनतम)
स्तर AA
बटन और summary की पंक्ति कम से कम 44 पिक्सेल ऊँची हैं, 24 पिक्सेल की न्यूनतम सीमा से काफ़ी ऊपर।
-
4.1.2 नाम, भूमिका, मान
स्तर A
बटन का aria-expanded और details की खुली स्थिति सामने आती हैं, इसलिए स्थिति बदलते ही उसकी घोषणा होती है।
उपयोग
इसे कब इस्तेमाल करें
इसे अपनाएँ
- लंबे विवरण, जहाँ ज़्यादातर लोगों को पहला पैराग्राफ़ चाहिए और कुछ को बाक़ी भी।
- भरे हुए पेज पर कम ज़रूरी ब्योरा: स्पेसिफ़िकेशन, देखभाल के निर्देश, शर्तें।
कुछ और इस्तेमाल करें
- ऐसा टेक्स्ट जो फ़ैसला लेने या सुरक्षित रहने के लिए ज़रूरी है, जैसे शुल्क या चेतावनियाँ: उसे दिखाएँ।
- कई जुड़े हुए सेक्शन जिन्हें लोग सरसरी नज़र से देखते हैं: अकॉर्डियन उन्हें एक साथ रखता है।
- चीज़ों की लंबी सूचियाँ: पेजिनेशन या 'और लोड करें' वाली फ़ीड इस्तेमाल करें।
आम विफलताएँ
आमतौर पर यह कहाँ गलत होता है
सिर्फ़ सीएसएस से काटा गया टेक्स्ट
line-clamp पंक्तियों को स्क्रीन पर छिपाता है, पर स्क्रीन रीडर फिर भी हर शब्द पढ़ता है, इसलिए बटन ऐसा वादा करता है जो वह निभाता नहीं। यहाँ बाक़ी हिस्सा माँगे जाने तक सबके लिए छिपा रहता है।
ऐसा लिंक जो कहीं नहीं जाता
a href="#" एक लिंक की घोषणा करता है, स्क्रिप्ट न चले तो पेज के ऊपर कूद जाता है, और उसकी कोई विस्तारित स्थिति नहीं होती। सही एलिमेंट बटन है।
बटन के ऊपर जोड़ा गया टेक्स्ट
अगर नया टेक्स्ट बटन से पहले दिखे, तो बटन दबाने वाले स्क्रीन रीडर उपयोगकर्ता को उसे ढूँढने के लिए पीछे जाना पड़ता है। यहाँ वह बटन के बाद आता है।
ऐसा लेबल जो स्थिति दो बार कहता है
'और दिखाएँ' को 'कम दिखाएँ' में बदलने के साथ aria-expanded भी लगाने से "कम दिखाएँ, विस्तारित" सुनाई देता है। यहाँ नाम सामग्री के बारे में बताता है और कभी नहीं बदलता।
आधा कटा वाक्य
बटन के इर्द-गिर्द वाक्य को तोड़ने से दो टुकड़े बचते हैं जिनका किसी के लिए कोई मतलब नहीं। पैराग्राफ़ के अंत पर काटें।
छिपा टेक्स्ट जिस तक पेज में खोज नहीं पहुँचती
display: none से छिपा टेक्स्ट Ctrl+F को नहीं दिखता। hidden="until-found" और details, दोनों ब्राउज़र को टेक्स्ट ढूँढने और खोलने देते हैं।
नोट्स
इसे बनाना
- जब डिस्क्लोज़र को स्क्रिप्ट नहीं चाहिए, तब details और summary इस्तेमाल करें; जब ट्रिगर को सामग्री से अलग रखना हो या उसे खुलकर स्टाइल करना हो, तब aria-expanded वाला बटन।
- कई सीएसएस रीसेट [hidden] { display: none !important } लगाते हैं, जो until-found को फिर से साधारण hidden बना देता है। स्टाइलशीट पैनल के लिए display और content-visibility वापस ठीक करती है।
- ब्राउज़र के टेक्स्ट खोलने से ठीक पहले beforematch चलता है; स्क्रिप्ट उसी से aria-expanded लगाती है, ताकि बटन सच बताए।
- hidden="until-found" और पेज में खोज का मिलान होने पर details का खुलना Chromium ब्राउज़र में काम करते हैं; बाक़ी जगह टेक्स्ट बस बटन इस्तेमाल होने तक छिपा रहता है।
- फ़ोकस को खुले टेक्स्ट में न ले जाएँ: लोगों ने और माँगा है और वे जहाँ हैं वहीं से आगे पढ़ेंगे।
स्रोत: WAI-एआरआईए ऑथरिंग प्रैक्टिसेज़: डिस्क्लोज़र · एचटीएमएल: details एलिमेंट · एचटीएमएल: hidden एट्रिब्यूट
लाइट और डार्क थीम में, डेस्कटॉप और फ़ोन की चौड़ाई पर axe से और कीबोर्ड से जाँचा गया। अभी हर स्क्रीन रीडर और ब्राउज़र जोड़ी के साथ नहीं परखा गया। सुधार बताएँ