सुलभता पैटर्न · संवाद

टिप्पणी थ्रेड

हर टिप्पणी अपने लेखक के नाम वाला एक आर्टिकल है, और जवाब उस टिप्पणी के अंदर नेस्टेड सूची हैं जिसका वे जवाब देते हैं, इसलिए थ्रेड का आकार मार्कअप में है। जवाब, एडिट और डिलीट अपनी जगह पर खुलते हैं और फ़ोकस लेते हैं; Escape फ़ोकस को उसी बटन पर लौटाता है जिसने उन्हें खोला, और हर बदलाव की पुष्टि एक विनम्र स्टेटस में होती है।

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

लाइव डेमो

आज़माएँ

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

टिप्पणियाँ 6

500 अक्षर बाक़ी

  1. आशा राव

    मोज़ों के दो जोड़े साथ रखें। उधेवाड़ी के बाद रास्ता एक धारा बन जाता है, और गीले पैरों में जल्दी छाले पड़ते हैं।

    1. विक्रम शेट्टी

      सहमत। जल्दी सूखने वाले मोज़े हर रुपये के लायक थे।

    2. नेहा कुलकर्णी

      क्या रास्ते पर निशान हैं, या हमें लोनावला से गाइड चाहिए?

    3. आप

      गाँव तक निशान हैं। उसके बाद किले की दीवारों के साथ चलें।

  2. रोहन मेहता

    7 बजे से पहले निकलें। लोनावला लौटने वाली आख़िरी साझा जीपें 5 बजे तक निकल जाती हैं।

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

कीबोर्ड

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

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

कुंजीयह क्या करती है
TabयाShiftTabटिप्पणी बॉक्स, हर टिप्पणी के बटनों और थ्रेड टॉगल से पढ़ने के क्रम में गुज़रता है।
EnterयाSpaceजवाब दें पर, उस टिप्पणी के नीचे जवाब बॉक्स खोलता है और फ़ोकस उसमें ले जाता है। थ्रेड टॉगल पर, उसके जवाब छिपाता या दिखाता है।
Escapeजवाब बॉक्स, एडिट बॉक्स या डिलीट वाले सवाल में, उसे बंद करता है और फ़ोकस उसी बटन पर लौटाता है जिसने उसे खोला।
Enterटिप्पणी पोस्ट करें या जवाब पोस्ट करें पर, उसे पोस्ट करता है और फ़ोकस नई टिप्पणी पर ले जाता है। सहेजें पर, बदलाव रखता है और फ़ोकस एडिट पर लौटाता है।

स्क्रीन रीडर

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

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

कबअपेक्षित घोषणा
Tab किसी जवाब दें बटन पर पहुँचता हैआशा को जवाब दें, बटन, संक्षिप्त
Enter जवाब बॉक्स खोलता हैआशा को जवाब दें, संपादन बॉक्स, बहु-पंक्ति
जवाब पोस्ट होता हैआप, आर्टिकल (फ़ोकस नए जवाब पर), फिर: जवाब पोस्ट हुआ
फ़ोकस किसी थ्रेड टॉगल पर पहुँचता है3 जवाब छिपाएँ, बटन, विस्तारित
आपकी टिप्पणी पर डिलीट दबाया जाता हैयह टिप्पणी डिलीट करें? इसे पहले जैसा नहीं किया जा सकता। समूह। रद्द, बटन
एक टिप्पणी पोस्ट होती हैआप, आर्टिकल, फिर: टिप्पणी पोस्ट हुई

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

कोड

कोड कॉपी करें

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

मार्कअप

<section class="ap-comments" data-ap-comments aria-labelledby="cmt-h">
  <div class="ap-comments__head">
    <h3 class="ap-comments__count" id="cmt-h" tabindex="-1">Comments <span class="ap-comments__n" data-ap-cmt-total>6</span></h3>
    <p class="ap-comments__status" role="status"></p>
  </div>

  <form class="ap-comments__new" data-ap-cmt-new data-max="500" novalidate>
    <label class="ap-label" for="cmt-new-text">Add a comment</label>
    <textarea class="ap-input" id="cmt-new-text" name="comment" rows="3" aria-describedby="cmt-new-count"></textarea>
    <p class="ap-error" id="cmt-new-error" hidden><svg class="ap-comments__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5"/><path d="M12 16.5h.01"/></svg><span></span></p>
    <div class="ap-comments__bar">
      <p class="ap-comments__left" id="cmt-new-count"><span data-ap-cmt-left>500</span> <span data-ap-cmt-words>characters left</span></p>
      <button type="submit" class="ap-btn ap-btn--primary">Post comment</button>
    </div>
  </form>

  <ol class="ap-comments__list">
    <li>
      <article class="ap-comments__c" id="cmt-1" aria-labelledby="cmt-1-who" tabindex="-1">
        <span class="ap-comments__avatar" aria-hidden="true" translate="no">AR</span>
        <div class="ap-comments__main">
          <p class="ap-comments__meta"><span class="ap-comments__who" id="cmt-1-who">Asha Rao</span> <time datetime="2026-10-05T09:12+05:30" title="5 October 2026 at 09:12">3 hours ago<span class="ap-comments__vh">, <span>5 October 2026 at 09:12</span></span></time></p>
          <p class="ap-comments__text">Carry two pairs of socks. The trail turns into a stream after Udhewadi, and wet feet blister fast.</p>
          <div class="ap-comments__acts">
            <button type="button" class="ap-comments__act" data-ap-cmt-reply aria-label="Reply to Asha" aria-expanded="false"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 6 6v4"/></svg>Reply</button>
          </div>
        </div>
      </article>
      <button type="button" class="ap-comments__toggle" data-ap-cmt-toggle aria-expanded="true" aria-controls="cmt-1-replies"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m6 9 6 6 6-6"/></svg><span>Hide 3 replies</span></button>
      <ol class="ap-comments__replies" id="cmt-1-replies">
        <li>
          <article class="ap-comments__c" id="cmt-1a" aria-labelledby="cmt-1a-who" tabindex="-1">
            <span class="ap-comments__avatar" aria-hidden="true" translate="no">VS</span>
            <div class="ap-comments__main">
              <p class="ap-comments__meta"><span class="ap-comments__who" id="cmt-1a-who">Vikram Shetty</span> <time datetime="2026-10-05T10:05+05:30" title="5 October 2026 at 10:05">2 hours ago<span class="ap-comments__vh">, <span>5 October 2026 at 10:05</span></span></time></p>
              <p class="ap-comments__text">Seconded. Quick-dry socks were worth every rupee.</p>
              <div class="ap-comments__acts">
                <button type="button" class="ap-comments__act" data-ap-cmt-reply aria-label="Reply to Vikram" aria-expanded="false"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 6 6v4"/></svg>Reply</button>
              </div>
            </div>
          </article>
        </li>
        <li>
          <article class="ap-comments__c" id="cmt-1b" aria-labelledby="cmt-1b-who" tabindex="-1">
            <span class="ap-comments__avatar" aria-hidden="true" translate="no">NK</span>
            <div class="ap-comments__main">
              <p class="ap-comments__meta"><span class="ap-comments__who" id="cmt-1b-who">Neha Kulkarni</span> <time datetime="2026-10-05T10:31+05:30" title="5 October 2026 at 10:31">2 hours ago<span class="ap-comments__vh">, <span>5 October 2026 at 10:31</span></span></time></p>
              <p class="ap-comments__text">Is the path marked, or do we need a guide from Lonavala?</p>
              <div class="ap-comments__acts">
                <button type="button" class="ap-comments__act" data-ap-cmt-reply aria-label="Reply to Neha" aria-expanded="false"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 6 6v4"/></svg>Reply</button>
              </div>
            </div>
          </article>
        </li>
        <li>
          <article class="ap-comments__c" id="cmt-1c" aria-labelledby="cmt-1c-who" tabindex="-1" data-own>
            <span class="ap-comments__avatar ap-comments__avatar--me" aria-hidden="true"><svg viewBox="0 0 24 24" focusable="false"><circle cx="12" cy="8.5" r="3.5"/><path d="M5 20a7 7 0 0 1 14 0"/></svg></span>
            <div class="ap-comments__main">
              <p class="ap-comments__meta"><span class="ap-comments__who" id="cmt-1c-who">You</span> <time datetime="2026-10-05T11:02+05:30" title="5 October 2026 at 11:02">1 hour ago<span class="ap-comments__vh">, <span>5 October 2026 at 11:02</span></span></time></p>
              <p class="ap-comments__text">It's marked up to the village. After that, follow the fort walls.</p>
              <div class="ap-comments__acts">
                <button type="button" class="ap-comments__act" data-ap-cmt-edit aria-label="Edit your comment"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"/></svg>Edit</button>
                <button type="button" class="ap-comments__act" data-ap-cmt-delete aria-label="Delete your comment"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 7h16"/><path d="M10 11v6M14 11v6"/><path d="M6 7l1 13h10l1-13"/><path d="M9 7V4h6v3"/></svg>Delete</button>
              </div>
            </div>
          </article>
        </li>
      </ol>
    </li>
    <li>
      <article class="ap-comments__c" id="cmt-2" aria-labelledby="cmt-2-who" tabindex="-1">
        <span class="ap-comments__avatar" aria-hidden="true" translate="no">RM</span>
        <div class="ap-comments__main">
          <p class="ap-comments__meta"><span class="ap-comments__who" id="cmt-2-who">Rohan Mehta</span> <time datetime="2026-10-04T18:40+05:30" title="4 October 2026 at 18:40">17 hours ago<span class="ap-comments__vh">, <span>4 October 2026 at 18:40</span></span></time></p>
          <p class="ap-comments__text">Start before 7. The last shared jeeps back to Lonavala leave by 5.</p>
          <div class="ap-comments__acts">
            <button type="button" class="ap-comments__act" data-ap-cmt-reply aria-label="Reply to Rohan" aria-expanded="false"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 6 6v4"/></svg>Reply</button>
          </div>
        </div>
      </article>
      <button type="button" class="ap-comments__toggle" data-ap-cmt-toggle aria-expanded="false" aria-controls="cmt-2-replies"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m6 9 6 6 6-6"/></svg><span>Show 1 reply</span></button>
      <ol class="ap-comments__replies" id="cmt-2-replies" hidden>
        <li>
          <article class="ap-comments__c" id="cmt-2a" aria-labelledby="cmt-2a-who" tabindex="-1">
            <span class="ap-comments__avatar" aria-hidden="true" translate="no">AR</span>
            <div class="ap-comments__main">
              <p class="ap-comments__meta"><span class="ap-comments__who" id="cmt-2a-who">Asha Rao</span> <time datetime="2026-10-04T19:15+05:30" title="4 October 2026 at 19:15">16 hours ago<span class="ap-comments__vh">, <span>4 October 2026 at 19:15</span></span></time></p>
              <p class="ap-comments__text">And carry cash. The village stalls can't take UPI when the network drops.</p>
              <div class="ap-comments__acts">
                <button type="button" class="ap-comments__act" data-ap-cmt-reply aria-label="Reply to Asha" aria-expanded="false"><svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M9 14 4 9l5-5"/><path d="M4 9h10a6 6 0 0 1 6 6v4"/></svg>Reply</button>
              </div>
            </div>
          </article>
        </li>
      </ol>
    </li>
  </ol>

  <div class="ap-comments__spare">
    <form class="ap-comments__form" id="cmt-replyform" data-ap-cmt-replyform novalidate hidden>
      <label class="ap-label" for="cmt-reply-text" data-ap-cmt-replylabel>Reply</label>
      <textarea class="ap-input" id="cmt-reply-text" name="reply" rows="2"></textarea>
      <p class="ap-error" id="cmt-reply-error" hidden><svg class="ap-comments__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5"/><path d="M12 16.5h.01"/></svg><span>Write a reply first.</span></p>
      <div class="ap-comments__btns">
        <button type="button" class="ap-btn" data-ap-cmt-cancel>Cancel</button>
        <button type="submit" class="ap-btn ap-btn--primary">Post reply</button>
      </div>
    </form>
    <form class="ap-comments__form" id="cmt-editform" data-ap-cmt-editform novalidate hidden>
      <label class="ap-label" for="cmt-edit-text">Edit your comment</label>
      <textarea class="ap-input" id="cmt-edit-text" name="edit" rows="2"></textarea>
      <p class="ap-error" id="cmt-edit-error" hidden><svg class="ap-comments__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="9"/><path d="M12 7.5v5"/><path d="M12 16.5h.01"/></svg><span>Write something, or delete the comment instead.</span></p>
      <div class="ap-comments__btns">
        <button type="button" class="ap-btn" data-ap-cmt-cancel>Cancel</button>
        <button type="submit" class="ap-btn ap-btn--primary">Save</button>
      </div>
    </form>
    <div class="ap-comments__confirm" role="group" aria-labelledby="cmt-confirm-q" data-ap-cmt-confirm hidden>
      <p class="ap-comments__q" id="cmt-confirm-q">Delete this comment? This cannot be undone.</p>
      <div class="ap-comments__btns">
        <button type="button" class="ap-btn" data-ap-cmt-keep>Cancel</button>
        <button type="button" class="ap-btn ap-btn--danger" data-ap-cmt-remove>Delete</button>
      </div>
    </div>
  </div>
  <p class="ap-comments__vh" aria-live="polite" data-ap-cmt-say></p>
</section>

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

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

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

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

    टिप्पणियाँ अपने लेखक के नाम वाले आर्टिकल हैं, जवाब उस टिप्पणी के अंदर नेस्टेड सूचियाँ हैं जिसका वे जवाब देते हैं, और गिनती हेडिंग का हिस्सा है।

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

    जवाब देना, थ्रेड समेटना, एडिट और डिलीट करना, सब साधारण बटनों के साथ कीबोर्ड से होता है।

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

    जवाब या एडिट बॉक्स खोलने पर फ़ोकस उसमें जाता है; पोस्ट करने पर फ़ोकस नई टिप्पणी पर जाता है; रद्द करने पर वह उस बटन पर लौटता है जिससे शुरुआत हुई।

  • 3.3.1 त्रुटि पहचान स्तर A

    ख़ाली या बहुत लंबी टिप्पणी पोस्ट नहीं होती; बॉक्स के नीचे एक त्रुटि बताती है क्यों, जो बॉक्स से जुड़ी होती है और घोषित होती है।

  • 3.3.4 त्रुटि निवारण (क़ानूनी, वित्तीय, डेटा) स्तर AA

    डिलीट करने से पहले अपनी जगह पर पूछा जाता है, रद्द पर फ़ोकस के साथ, इसलिए एक भूल से दबाई गई कुंजी कभी टिप्पणी नहीं हटाती।

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

    हर जवाब दें बटन और जवाब बॉक्स बताता है कि वह किसे जवाब देता है; थ्रेड टॉगल और जवाब दें बटन aria-expanded से बताते हैं कि वे खुले हैं या नहीं।

  • 4.1.3 स्टेटस मैसेज स्तर AA

    टिप्पणी पोस्ट हुई, जवाब पोस्ट हुआ, टिप्पणी अपडेट हुई और टिप्पणी डिलीट हुई एक स्टेटस क्षेत्र में लिखे जाते हैं, जो फ़ोकस हिलाए बिना पढ़े जाते हैं।

उपयोग

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

इसे अपनाएँ

  • किसी लेख, उत्पाद, डिज़ाइन या काम के नीचे की चर्चाएँ, जहाँ जवाब किसी एक टिप्पणी का उत्तर देते हैं।
  • समीक्षा थ्रेड जहाँ लोग अपना लिखा एडिट करते हैं या हटाते हैं।

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

  • कुछ लोगों के बीच तुरंत की बातचीत: उसके लिए लाइव लॉग वाली चैट बेहतर है।
  • एक स्तर से गहरे थ्रेड: जवाबों के एक स्तर के बाद नेस्टिंग को सुनकर और देखकर समझना मुश्किल होता है।
  • छोटी रेटिंग या प्रतिक्रियाएँ: प्रतिक्रिया पट्टी कम में ज़्यादा कहती है।

आम विफलताएँ

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

  • ऐसे जवाब बटन जिन पर सिर्फ़ जवाब दें लिखा हो

    एक जैसे जवाब दें बटनों की सूची संदर्भ के बिना बेमानी है। यहाँ हर बटन का नाम आशा को जवाब दें, नेहा को जवाब दें वगैरह है।

  • कहीं और खुलने वाला जवाब बॉक्स

    पेज के ऊपर खुला बॉक्स, या बटन पर छूटा फ़ोकस, लोगों को उसे खोजने पर मजबूर करता है। यहाँ वह टिप्पणी के नीचे खुलता है और फ़ोकस लेता है।

  • पोस्ट करने के बाद फ़ोकस खो जाना

    अगर फ़ोकस किसी ऐसे बटन पर रहे जो अभी-अभी ग़ायब हुआ है, तो कीबोर्ड इस्तेमाल करने वाले पेज के ऊपर पहुँच जाते हैं। फ़ोकस नई टिप्पणी पर जाता है, और स्टेटस इसकी पुष्टि करता है।

  • बिना वापसी के रास्ते वाला डिलीट

    एडिट के बगल में एक बार दबाने वाला डिलीट ग़लती से दब जाना आसान है। यहाँ सवाल अपनी जगह पर आता है, रद्द पर फ़ोकस के साथ।

  • जवाब का इकलौता संकेत इंडेंटेशन

    इंडेंट किए गए div नेस्टेड दिखते हैं पर सपाट पढ़े जाते हैं। नेस्टेड सूचियाँ हर जवाब की थ्रेड में जगह स्क्रीन रीडर को भी बताती हैं।

  • बिना असली तारीख़ की सापेक्ष तारीख़ें

    "3 घंटे पहले" पुराना पड़ जाता है और अस्पष्ट है। time एलिमेंट सटीक तारीख़ और समय रखता है, और स्क्रीन रीडर उसे सापेक्ष समय के बाद सुनाते हैं।

नोट्स

इसे बनाना

  • एक जवाब फ़ॉर्म, एक एडिट फ़ॉर्म और एक डिलीट वाला सवाल ज़रूरत की जगह ले जाए जाते हैं, इसलिए एक समय में एक से ज़्यादा कभी खुला नहीं रहता और id अनोखे रहते हैं।
  • नज़र से छिपी पूरी तारीख़ time एलिमेंट के अंदर सापेक्ष समय के बाद है; title एट्रिब्यूट माउस इस्तेमाल करने वालों को होवर पर वही तारीख़ दिखाता है।
  • थ्रेड टॉगल aria-expanded रखते हैं और अपने शब्द भी छिपाएँ और दिखाएँ के बीच बदलते हैं, जैसा GOV.UK अकॉर्डियन करता है; दोनों एक ही बात कहते हैं, इसलिए कभी असहमत नहीं होते।
  • समेटे हुए थ्रेड में जवाब पोस्ट करने पर पहले थ्रेड खुलता है, ताकि फ़ोकस कभी किसी छिपी चीज़ पर न पहुँचे।
  • हर गिनती वाला वाक्यांश (3 जवाब छिपाएँ) टेक्स्ट का एक ही टुकड़ा है, ताकि अनुवाद शब्दों और संख्या का क्रम बदल सकें।

स्रोत: WAI-एआरआईए ऑथरिंग प्रैक्टिसेज़: डिस्क्लोज़र · एचटीएमएल: article एलिमेंट

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