सुलभता पैटर्न · नेविगेशन

खड़े टैब

सेटिंग्स जैसी पट्टी: एक टैब स्टॉप, उसके अंदर ऊपर और नीचे के ऐरो, और aria-orientation="vertical", ताकि सहायक तकनीक जाने कि कौन-से ऐरो सुझाने हैं। जगह कम हो तो पट्टी स्क्रॉल होने वाली पंक्ति बन जाती है, और स्क्रिप्ट दिशा और ऐरो कुंजियों को उसी के हिसाब से बदल देती है।

डब्ल्यूसीएजी मानदंड
6
कीबोर्ड नियम
4
जाँच का तरीक़ा
axe, कीबोर्ड और इंस्पेक्टर

लाइव डेमो

आज़माएँ

इसे माउस, कीबोर्ड या स्क्रीन रीडर से इस्तेमाल करें। साथ का इंस्पेक्टर दिखाता है कि आपके इस्तेमाल के दौरान ब्राउज़र सहायक तकनीक को क्या बताता है: फ़ोकस, स्थिति में बदलाव और घोषणाएँ।

सेटिंग्स

अकाउंट

शॉप में आप कैसे दिखते हैं, और आपके ऑर्डर कहाँ जाते हैं।

नाम
आशा राव
सदस्य कब से
मार्च 2021
डिलीवरी पता
कोरेगाँव पार्क, पुणे
भाषा
अंग्रेज़ी (भारत)

जावास्क्रिप्ट के बिना डेमो उतना ही काम करता है जितना उसका एचटीएमएल; इंस्पेक्टर के लिए जावास्क्रिप्ट चाहिए।

कीबोर्ड

जिन कुंजियों पर यह काम करता है

हर क्रिया पॉइंटर के बिना काम करती है।

कुंजीयह क्या करती है
Tabटैब सूची में, चुने हुए टैब पर ले जाता है; अगला Tab उसके पैनल में ले जाता है।
Arrow DownयाArrow Upअगले या पिछले टैब पर ले जाता है, सिरों पर घूमकर दूसरी ओर पहुँचता है, और उसका पैनल दिखाता है।
HomeयाEndपहले या आख़िरी टैब पर ले जाता है।
Arrow RightयाArrow Leftकम जगह में पट्टी के पंक्ति बन जाने पर Down और Up वाला ही काम करते हैं।

स्क्रीन रीडर

यह क्या घोषित करता है

मार्कअप की भूमिकाओं, नामों और स्थितियों से लिखा गया।

कबअपेक्षित घोषणा
Tab टैब सूची तक पहुँचता हैसेटिंग्स, टैब सूची। अकाउंट, टैब, चयनित, 5 में से 1
Arrow Down अगले टैब पर ले जाता हैसूचनाएँ, टैब, चयनित, 5 में से 2
Tab पैनल में ले जाता हैसूचनाएँ, टैब पैनल
पैनल की कोई सेटिंग बंद की जाती हैकीमत घटने पर, चेकबॉक्स, चेक नहीं किया गया

ये अपेक्षित घोषणाएँ हैं, रिकॉर्डिंग नहीं। स्क्रीन रीडर और ब्राउज़र के हिसाब से शब्द और क्रम बदलते हैं।

कोड

कोड कॉपी करें

वही फ़ाइलें जिन पर यह डेमो चलता है। स्टाइल एक प्रीफ़िक्स के साथ परोसी जाती हैं जो इस साइट की अपनी स्टाइल को डेमो से दूर रखता है; आप जो कॉपी करते हैं वह मूल है।

मार्कअप

<div class="ap-vertical-tabs" data-ap-vertical-tabs>
  <div class="ap-vertical-tabs__frame">
    <div class="ap-vertical-tabs__rail">
      <h3 class="ap-vertical-tabs__label" id="vtabs-label">Settings</h3>
      <div class="ap-vertical-tabs__list" role="tablist" aria-labelledby="vtabs-label" aria-orientation="vertical">
        <button type="button" class="ap-vertical-tabs__tab" role="tab" id="vtabs-tab-account" aria-selected="true" aria-controls="vtabs-panel-account">
          <svg class="ap-vertical-tabs__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg>
          <span>Account</span>
        </button>
        <button type="button" class="ap-vertical-tabs__tab" role="tab" id="vtabs-tab-notifications" aria-selected="false" aria-controls="vtabs-panel-notifications" tabindex="-1">
          <svg class="ap-vertical-tabs__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M6 16V11a6 6 0 0 1 12 0v5l2 2H4Z"/><path d="M10 21h4"/></svg>
          <span>Notifications</span>
        </button>
        <button type="button" class="ap-vertical-tabs__tab" role="tab" id="vtabs-tab-privacy" aria-selected="false" aria-controls="vtabs-panel-privacy" tabindex="-1">
          <svg class="ap-vertical-tabs__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 3 5 6v5c0 5 3 8.5 7 10 4-1.5 7-5 7-10V6Z"/><path d="m9 12 2 2 4-4"/></svg>
          <span>Privacy</span>
        </button>
        <button type="button" class="ap-vertical-tabs__tab" role="tab" id="vtabs-tab-appearance" aria-selected="false" aria-controls="vtabs-panel-appearance" tabindex="-1">
          <svg class="ap-vertical-tabs__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/></svg>
          <span>Appearance</span>
        </button>
        <button type="button" class="ap-vertical-tabs__tab" role="tab" id="vtabs-tab-billing" aria-selected="false" aria-controls="vtabs-panel-billing" tabindex="-1">
          <svg class="ap-vertical-tabs__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 10h18M7 15h4"/></svg>
          <span>Billing</span>
        </button>
      </div>
    </div>

    <div class="ap-vertical-tabs__panel" role="tabpanel" id="vtabs-panel-account" aria-labelledby="vtabs-tab-account" tabindex="0">
      <h4 class="ap-vertical-tabs__name">Account</h4>
      <p class="ap-vertical-tabs__lead">How you appear in the shop, and where your orders go.</p>
      <dl class="ap-vertical-tabs__facts">
        <div><dt>Name</dt><dd>Asha Rao</dd></div>
        <div><dt>Member since</dt><dd>March 2021</dd></div>
        <div><dt>Delivery address</dt><dd>Koregaon Park, Pune</dd></div>
        <div><dt>Language</dt><dd>English (India)</dd></div>
      </dl>
    </div>

    <div class="ap-vertical-tabs__panel" role="tabpanel" id="vtabs-panel-notifications" aria-labelledby="vtabs-tab-notifications" tabindex="0" hidden>
      <h4 class="ap-vertical-tabs__name">Notifications</h4>
      <p class="ap-vertical-tabs__lead">Choose what we send you. Security messages always come through.</p>
      <div class="ap-vertical-tabs__options">
        <div class="ap-vertical-tabs__option">
          <input type="checkbox" id="vtabs-orders" aria-describedby="vtabs-orders-hint" checked />
          <label for="vtabs-orders">Order updates</label>
          <p class="ap-vertical-tabs__hint" id="vtabs-orders-hint">Dispatch, delivery and returns.</p>
        </div>
        <div class="ap-vertical-tabs__option">
          <input type="checkbox" id="vtabs-prices" aria-describedby="vtabs-prices-hint" checked />
          <label for="vtabs-prices">Price drops</label>
          <p class="ap-vertical-tabs__hint" id="vtabs-prices-hint">When something you saved costs less.</p>
        </div>
        <div class="ap-vertical-tabs__option">
          <input type="checkbox" id="vtabs-news" aria-describedby="vtabs-news-hint" />
          <label for="vtabs-news">New arrivals</label>
          <p class="ap-vertical-tabs__hint" id="vtabs-news-hint">One email a week, on Fridays.</p>
        </div>
      </div>
    </div>

    <div class="ap-vertical-tabs__panel" role="tabpanel" id="vtabs-panel-privacy" aria-labelledby="vtabs-tab-privacy" tabindex="0" hidden>
      <h4 class="ap-vertical-tabs__name">Privacy</h4>
      <p class="ap-vertical-tabs__lead">Decide what other shoppers see and what we use to suggest things.</p>
      <div class="ap-vertical-tabs__options">
        <div class="ap-vertical-tabs__option">
          <input type="checkbox" id="vtabs-reviews" aria-describedby="vtabs-reviews-hint" checked />
          <label for="vtabs-reviews">Show my name on reviews</label>
          <p class="ap-vertical-tabs__hint" id="vtabs-reviews-hint">Otherwise reviews show your initials.</p>
        </div>
        <div class="ap-vertical-tabs__option">
          <input type="checkbox" id="vtabs-history" aria-describedby="vtabs-history-hint" />
          <label for="vtabs-history">Use my orders for suggestions</label>
          <p class="ap-vertical-tabs__hint" id="vtabs-history-hint">Recommendations based on what you bought.</p>
        </div>
      </div>
    </div>

    <div class="ap-vertical-tabs__panel" role="tabpanel" id="vtabs-panel-appearance" aria-labelledby="vtabs-tab-appearance" tabindex="0" hidden>
      <h4 class="ap-vertical-tabs__name">Appearance</h4>
      <p class="ap-vertical-tabs__lead">How the shop looks on this device.</p>
      <fieldset class="ap-vertical-tabs__group">
        <legend>Theme</legend>
        <label class="ap-vertical-tabs__choice"><input type="radio" name="vtabs-theme" value="system" checked /> Match the system</label>
        <label class="ap-vertical-tabs__choice"><input type="radio" name="vtabs-theme" value="light" /> Light</label>
        <label class="ap-vertical-tabs__choice"><input type="radio" name="vtabs-theme" value="dark" /> Dark</label>
      </fieldset>
    </div>

    <div class="ap-vertical-tabs__panel" role="tabpanel" id="vtabs-panel-billing" aria-labelledby="vtabs-tab-billing" tabindex="0" hidden>
      <h4 class="ap-vertical-tabs__name">Billing</h4>
      <p class="ap-vertical-tabs__lead">Your membership renews on its own; you can cancel at any time.</p>
      <dl class="ap-vertical-tabs__facts">
        <div><dt>Plan</dt><dd>Nila Plus, yearly</dd></div>
        <div><dt>Next payment</dt><dd>₹1,499 on 12 March</dd></div>
        <div><dt>Pay with</dt><dd>Card ending 4242</dd></div>
      </dl>
    </div>
  </div>
</div>

डब्ल्यूसीएजी 2.2

यह किन मानदंडों को पूरा करता है

वे सफलता मानदंड जिनका यह पैटर्न ध्यान रखता है, और कैसे।

  • 1.3.1 जानकारी और संबंध स्तर A

    रोल टैब को उनके पैनलों से जोड़ते हैं, और aria-orientation बताता है कि सूची ऊपर से नीचे चलती है, इसलिए ढाँचा सिर्फ़ दिखाया नहीं जाता, सहायक तकनीक तक पहुँचता भी है।

  • 1.4.1 रंग का उपयोग स्तर A

    चुना हुआ टैब उभरा हुआ है, गाढ़े टेक्स्ट में है और एक पट्टी से चिह्नित है, इसलिए वह रंग पर निर्भर नहीं करता।

  • 2.1.1 कीबोर्ड स्तर A

    ऐरो कुंजियाँ, Home और End टैब के बीच ले जाती हैं, और पैनलों के अंदर की हर सेटिंग एक नेटिव फ़ील्ड है।

  • 2.4.3 फ़ोकस क्रम स्तर A

    Tab क्रम में सिर्फ़ चुना हुआ टैब है, इसलिए अगला Tab सीधे उसके पैनल में जाता है।

  • 2.4.7 फ़ोकस दिखाई देना स्तर AA

    फ़ोकस वाले टैब पर एक रिंग दिखती है, जो पट्टी के सामने 3:1 से ज़्यादा कंट्रास्ट रखती है।

  • 4.1.2 नाम, भूमिका, मान स्तर A

    हर टैब पर role=tab और aria-selected है, और हर पैनल का लेबल उसका टैब है।

उपयोग

इसे कब इस्तेमाल करें

इसे अपनाएँ

  • पाँच या ज़्यादा सेक्शन वाली सेटिंग्स और प्राथमिकताएँ, जहाँ किनारे की पट्टी में लंबे लेबल के लिए जगह हो।
  • ऐसे लेबल जो टैब की एक पंक्ति में बैठने के लिए बहुत लंबे, या बहुत ज़्यादा हों।

कुछ और इस्तेमाल करें

  • पेजों के बीच जाना: aria-current से चिह्नित लिंक वाला साइडबार नेविगेशन इस्तेमाल करें।
  • दो या तीन सेक्शन: टैब की एक पंक्ति या सेगमेंटेड कंट्रोल हल्का रहता है।

आम विफलताएँ

आमतौर पर यह कहाँ गलत होता है

  • aria-orientation छूट गया

    इसके बिना टैब सूची को आड़ा माना जाता है: स्क्रीन रीडर Left और Right सुझाते हैं, जबकि स्क्रीन पर पट्टी Up और Down के लिए बुलाती है।

  • लेआउट के साथ न चलने वाली ऐरो कुंजियाँ

    जो पट्टी फ़ोन पर पंक्ति बन जाए पर फिर भी सिर्फ़ Up और Down को जवाब दे, वह सबको उलझाती है। यहाँ दिशा और कुंजियाँ, दोनों लेआउट के साथ चलती हैं।

  • टैब का रूप लिए लिंक

    अगर हर आइटम नया पेज खोलता है, तो वह नेविगेशन है: aria-current के साथ nav लैंडमार्क में लिंक, टैब सूची नहीं।

  • बिना शब्दों के आइकन

    सिर्फ़ आइकन वाली पट्टी जगह तो बचाती है, पर लोगों को अंदाज़ा लगाने पर छोड़ देती है। यहाँ हर टैब का अपना शब्द है; आइकन सिर्फ़ सजावट है।

  • चयन सिर्फ़ रंग से दिखाया गया

    हल्के रंग वाला बैकग्राउंड आसानी से नज़र से छूट जाता है। यहाँ चुना हुआ टैब उभरा हुआ, ज़्यादा गाढ़ा और एक पट्टी से चिह्नित है।

नोट्स

इसे बनाना

  • कंपोनेंट का आकार बदलने पर स्क्रिप्ट पट्टी का लेआउट पढ़ती है और aria-orientation को “vertical” या “horizontal” पर सेट करती है; ऐरो कुंजियाँ उसी मान के साथ चलती हैं।
  • हर पैनल एक हेडिंग और सादे टेक्स्ट से शुरू होता है, इसलिए हर पैनल पर tabindex=0 है और अगला Tab उस तक पहुँचता है।
  • यहाँ सेटिंग्स बदलते ही लागू हो जाती हैं। अगर आपकी सेटिंग्स को सहेजें बटन चाहिए, तो उसे हर पैनल के अंदर रखें, ताकि साफ़ रहे कि वह क्या सहेजता है।
  • आइकन currentColor से बने aria-hidden एसवीजी हैं, इसलिए दोनों थीम में वे टेक्स्ट के रंग के साथ चलते हैं।

स्रोत: WAI-एआरआईए ऑथरिंग प्रैक्टिसेज़: टैब

लाइट और डार्क थीम में, डेस्कटॉप और फ़ोन की चौड़ाई पर axe से और कीबोर्ड से जाँचा गया। अभी हर स्क्रीन रीडर और ब्राउज़र जोड़ी के साथ नहीं परखा गया। सुधार बताएँ