सुलभता पैटर्न · फ़ॉर्म और फ़्लो

कई चरणों वाला फ़ॉर्म

हर चरण एक fieldset है जिसकी हेडिंग चरण बदलने पर फ़ोकस ले लेती है, ताकि स्क्रीन रीडर बताए कि व्यक्ति कहाँ है, और प्रगति सूची मौजूदा चरण को aria-current="step" से और पूरे हो चुके चरणों को शब्दों में दिखाती है। आगे बढ़ने से पहले हर चरण जाँचा जाता है, पीछे जाने पर हर जवाब बना रहता है, और समीक्षा का चरण बदलें बटन से हर हिस्से पर वापस ले जाता है।

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

लाइव डेमो

आज़माएँ

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

चेकआउट

ब्लॉक-प्रिंट सूती बेडकवर, डबल

  1. विवरण
  2. डिलीवरी
  3. भुगतान
  4. समीक्षा

चरण 1, कुल 4 आपका विवरण

रसीद के लिए।

10 अंक, डिलीवरी की जानकारी के लिए।

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

कीबोर्ड

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

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

कुंजीयह क्या करती है
TabयाShiftTabस्क्रीन पर दिख रहे चरण के फ़ील्ड से होकर, फिर पीछे और आगे बढ़ें पर ले जाता है। बाकी चरण छिपे हैं, इसलिए Tab उन तक कभी नहीं पहुँचता।
Enterकिसी फ़ील्ड में, वही करता है जो आगे बढ़ें करता है: इस चरण को जाँचता है, फिर आगे बढ़ता है या समस्याओं की सूची देता है।
EnterयाSpaceपीछे पर, हर जवाब को बनाए रखते हुए पिछला चरण दिखाता है, और फ़ोकस उसकी हेडिंग पर ले जाता है।
EnterयाSpaceसमीक्षा में बदलें पर, वह चरण खोलता है; वहाँ आगे बढ़ना आपको वापस समीक्षा पर ले आता है।
Arrow DownयाArrow Upविकल्पों के समूह में, अगला या पिछला विकल्प चुनता है।

स्क्रीन रीडर

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

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

कबअपेक्षित घोषणा
आगे बढ़ें दूसरे चरण पर ले जाता हैचरण 2, कुल 4 डिलीवरी, हेडिंग स्तर 4
चरणों की सूची पढ़ी जाती हैचेकआउट के चरण, सूची, 4 आइटम। विवरण, पूरा। डिलीवरी, मौजूदा चरण। भुगतान। समीक्षा।
मोबाइल नंबर के बिना आगे बढ़ें दबाया जाता हैआपके विवरण में एक समस्या है, समूह। अपना मोबाइल नंबर लिखें
पीछे दबाया जाता हैचरण 1, कुल 4 आपका विवरण, हेडिंग स्तर 4
समीक्षा के डिलीवरी वाले हिस्से पर बदलें दबाया जाता हैचरण 2, कुल 4 डिलीवरी, हेडिंग स्तर 4
ऑर्डर किया जाता हैऑर्डर हो गया। यह डेमो कुछ नहीं भेजता।

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

कोड

कोड कॉपी करें

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

मार्कअप

<form class="ap-wizard" data-ap-wizard novalidate aria-labelledby="wiz-form-name">
  <div class="ap-wizard__top">
    <h3 class="ap-wizard__name" id="wiz-form-name">Checkout</h3>
    <p class="ap-wizard__sub">Block-print cotton bedcover, double</p>
  </div>

  <ol class="ap-wizard__steps" aria-label="Checkout steps">
    <li class="ap-wizard__step" aria-current="step" data-ap-step="1">
      <span class="ap-wizard__dot" aria-hidden="true"><span class="ap-wizard__num">1</span><svg class="ap-wizard__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg></span>
      <span class="ap-wizard__step-name">Details</span>
      <span class="ap-wizard__state" hidden>Done</span>
    </li>
    <li class="ap-wizard__step" data-ap-step="2">
      <span class="ap-wizard__dot" aria-hidden="true"><span class="ap-wizard__num">2</span><svg class="ap-wizard__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg></span>
      <span class="ap-wizard__step-name">Delivery</span>
      <span class="ap-wizard__state" hidden>Done</span>
    </li>
    <li class="ap-wizard__step" data-ap-step="3">
      <span class="ap-wizard__dot" aria-hidden="true"><span class="ap-wizard__num">3</span><svg class="ap-wizard__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg></span>
      <span class="ap-wizard__step-name">Payment</span>
      <span class="ap-wizard__state" hidden>Done</span>
    </li>
    <li class="ap-wizard__step" data-ap-step="4">
      <span class="ap-wizard__dot" aria-hidden="true"><span class="ap-wizard__num">4</span><svg class="ap-wizard__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg></span>
      <span class="ap-wizard__step-name">Review</span>
      <span class="ap-wizard__state" hidden>Done</span>
    </li>
  </ol>

  <div class="ap-wizard__body">
    <div class="ap-wizard__summary" id="wiz-summary" role="group" aria-labelledby="wiz-summary-name" aria-describedby="wiz-summary-list" tabindex="-1" hidden>
      <h4 class="ap-wizard__summary-name" id="wiz-summary-name"><svg class="ap-wizard__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>There is a problem with your details</h4>
      <ul class="ap-wizard__summary-list" id="wiz-summary-list"></ul>
    </div>

    <fieldset class="ap-wizard__panel" data-ap-panel="1">
      <legend class="ap-wizard__legend"><h4 class="ap-wizard__h" id="wiz-h-1" tabindex="-1"><span class="ap-wizard__kicker">Step 1 of 4</span> Your details</h4></legend>
      <div class="ap-wizard__fields">
        <div class="ap-field ap-wizard__field ap-wizard__field--wide">
          <label class="ap-label" for="wiz-name">Full name</label>
          <input class="ap-input" id="wiz-name" name="name" type="text" autocomplete="name" spellcheck="false" required />
        <p class="ap-error ap-wizard__error" id="wiz-name-error" hidden><svg class="ap-wizard__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 class="ap-wizard__vh">Error:</span> <span data-ap-text></span></p>
        </div>
        <div class="ap-field ap-wizard__field">
          <label class="ap-label" for="wiz-email">Email address</label>
          <p class="ap-hint" id="wiz-email-hint">For the receipt.</p>
          <input class="ap-input" id="wiz-email" name="email" type="email" autocomplete="email" spellcheck="false" required aria-describedby="wiz-email-hint" />
        <p class="ap-error ap-wizard__error" id="wiz-email-error" hidden><svg class="ap-wizard__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 class="ap-wizard__vh">Error:</span> <span data-ap-text></span></p>
        </div>
        <div class="ap-field ap-wizard__field">
          <label class="ap-label" for="wiz-tel">Mobile number</label>
          <p class="ap-hint" id="wiz-tel-hint">10 digits, for delivery updates.</p>
          <input class="ap-input" id="wiz-tel" name="tel" type="tel" autocomplete="tel" required aria-describedby="wiz-tel-hint" />
        <p class="ap-error ap-wizard__error" id="wiz-tel-error" hidden><svg class="ap-wizard__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 class="ap-wizard__vh">Error:</span> <span data-ap-text></span></p>
        </div>
      </div>
    </fieldset>

    <fieldset class="ap-wizard__panel" data-ap-panel="2" hidden>
      <legend class="ap-wizard__legend"><h4 class="ap-wizard__h" id="wiz-h-2" tabindex="-1"><span class="ap-wizard__kicker">Step 2 of 4</span> Delivery</h4></legend>
      <div class="ap-wizard__fields">
        <div class="ap-field ap-wizard__field ap-wizard__field--wide">
          <label class="ap-label" for="wiz-line1">Flat, house and street</label>
          <input class="ap-input" id="wiz-line1" name="line1" type="text" autocomplete="address-line1" required />
        <p class="ap-error ap-wizard__error" id="wiz-line1-error" hidden><svg class="ap-wizard__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 class="ap-wizard__vh">Error:</span> <span data-ap-text></span></p>
        </div>
        <div class="ap-field ap-wizard__field">
          <label class="ap-label" for="wiz-city">Town or city</label>
          <input class="ap-input" id="wiz-city" name="city" type="text" autocomplete="address-level2" required />
        <p class="ap-error ap-wizard__error" id="wiz-city-error" hidden><svg class="ap-wizard__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 class="ap-wizard__vh">Error:</span> <span data-ap-text></span></p>
        </div>
        <div class="ap-field ap-wizard__field">
          <label class="ap-label" for="wiz-pin">PIN code</label>
          <p class="ap-hint" id="wiz-pin-hint">6 digits.</p>
          <input class="ap-input ap-wizard__short" id="wiz-pin" name="pin" type="text" inputmode="numeric" autocomplete="postal-code" required aria-describedby="wiz-pin-hint" />
        <p class="ap-error ap-wizard__error" id="wiz-pin-error" hidden><svg class="ap-wizard__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 class="ap-wizard__vh">Error:</span> <span data-ap-text></span></p>
        </div>
        <fieldset class="ap-wizard__choice ap-wizard__field--wide">
          <legend class="ap-label">Delivery speed</legend>
          <label class="ap-wizard__option" for="wiz-speed-standard">
            <input type="radio" id="wiz-speed-standard" name="speed" value="standard" checked />
            <span class="ap-wizard__option-text"><span class="ap-wizard__option-name">Standard, free</span> <span class="ap-wizard__option-note">3 to 5 working days</span></span>
          </label>
          <label class="ap-wizard__option" for="wiz-speed-express">
            <input type="radio" id="wiz-speed-express" name="speed" value="express" />
            <span class="ap-wizard__option-text"><span class="ap-wizard__option-name">Express, ₹149</span> <span class="ap-wizard__option-note">Next working day</span></span>
          </label>
        </fieldset>
      </div>
    </fieldset>

    <fieldset class="ap-wizard__panel" data-ap-panel="3" hidden>
      <legend class="ap-wizard__legend"><h4 class="ap-wizard__h" id="wiz-h-3" tabindex="-1"><span class="ap-wizard__kicker">Step 3 of 4</span> Payment</h4></legend>
      <fieldset class="ap-wizard__choice" id="wiz-pay" aria-describedby="wiz-pay-hint">
        <legend class="ap-label">How would you like to pay?</legend>
        <p class="ap-hint" id="wiz-pay-hint">You pay after checking your order.</p>
        <p class="ap-error ap-wizard__error" id="wiz-pay-error" hidden><svg class="ap-wizard__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 class="ap-wizard__vh">Error:</span> <span data-ap-text></span></p>
          <label class="ap-wizard__option" for="wiz-pay-upi">
            <input type="radio" id="wiz-pay-upi" name="pay" value="upi" />
            <span class="ap-wizard__option-text"><span class="ap-wizard__option-name">UPI</span> <span class="ap-wizard__option-note">Any UPI app, on the next screen</span></span>
          </label>
          <label class="ap-wizard__option" for="wiz-pay-card">
            <input type="radio" id="wiz-pay-card" name="pay" value="card" />
            <span class="ap-wizard__option-text"><span class="ap-wizard__option-name">Card</span> <span class="ap-wizard__option-note">Debit or credit card</span></span>
          </label>
          <label class="ap-wizard__option" for="wiz-pay-cod">
            <input type="radio" id="wiz-pay-cod" name="pay" value="cod" />
            <span class="ap-wizard__option-text"><span class="ap-wizard__option-name">Cash on delivery</span> <span class="ap-wizard__option-note">₹40 handling fee</span></span>
          </label>
      </fieldset>
    </fieldset>

    <fieldset class="ap-wizard__panel" data-ap-panel="4" hidden>
      <legend class="ap-wizard__legend"><h4 class="ap-wizard__h" id="wiz-h-4" tabindex="-1"><span class="ap-wizard__kicker">Step 4 of 4</span> Check your order</h4></legend>
      <div class="ap-wizard__review">
        <div class="ap-wizard__group">
          <div class="ap-wizard__group-top"><h5 class="ap-wizard__group-name">Your details</h5><button type="button" class="ap-wizard__change" data-ap-goto="1">Change<span class="ap-wizard__vh"> your details</span></button></div>
          <dl class="ap-wizard__list">
          <div class="ap-wizard__row"><dt>Name</dt><dd data-ap-show="name"></dd></div>
          <div class="ap-wizard__row"><dt>Email</dt><dd data-ap-show="email"></dd></div>
          <div class="ap-wizard__row"><dt>Mobile</dt><dd data-ap-show="tel"></dd></div>
          </dl>
        </div>
        <div class="ap-wizard__group">
          <div class="ap-wizard__group-top"><h5 class="ap-wizard__group-name">Delivery</h5><button type="button" class="ap-wizard__change" data-ap-goto="2">Change<span class="ap-wizard__vh"> delivery</span></button></div>
          <dl class="ap-wizard__list">
          <div class="ap-wizard__row"><dt>Address</dt><dd data-ap-show="address"></dd></div>
          <div class="ap-wizard__row"><dt>Speed</dt><dd data-ap-show="speed"></dd></div>
          </dl>
        </div>
        <div class="ap-wizard__group">
          <div class="ap-wizard__group-top"><h5 class="ap-wizard__group-name">Payment</h5><button type="button" class="ap-wizard__change" data-ap-goto="3">Change<span class="ap-wizard__vh"> payment</span></button></div>
          <dl class="ap-wizard__list">
          <div class="ap-wizard__row"><dt>Method</dt><dd data-ap-show="pay"></dd></div>
          </dl>
        </div>
        <p class="ap-wizard__total"><span>Total to pay</span> <strong data-ap-total translate="no">₹3,450</strong></p>
      </div>
    </fieldset>
  </div>

  <div class="ap-wizard__foot">
    <p class="ap-wizard__status" role="status"><svg class="ap-wizard__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m5 12.5 4.5 4.5L19 7.5"/></svg><span data-ap-done></span></p>
    <button type="button" class="ap-btn" data-ap-back hidden>
      <svg class="ap-btn__icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="m15 6-6 6 6 6"/></svg>
      Back
    </button>
    <button type="submit" class="ap-btn ap-btn--primary" data-ap-next>Continue</button>
  </div>
</form>

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

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

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

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

    हर चरण एक fieldset है जिसका नाम उसकी हेडिंग से आता है, विकल्प अपने legend के साथ समूह में हैं, और प्रगति एक क्रमबद्ध सूची है जिसमें मौजूदा चरण चिह्नित है।

  • 1.3.5 इनपुट का उद्देश्य पहचानें स्तर AA

    नाम, ईमेल, मोबाइल, पता, क़स्बा और पिन कोड पर autocomplete टोकन हैं, ताकि ब्राउज़र हर चरण भर सके।

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

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

  • 2.4.6 हेडिंग और लेबल स्तर AA

    हर चरण की हेडिंग शब्दों में बताती है कि आप कहाँ हैं, चरण 2, कुल 4, फिर यह कि चरण किसलिए है।

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

    समस्याएँ चरण छोड़ने से पहले पकड़ी जाती हैं, aria-invalid से चिह्नित होती हैं, हर फ़ील्ड के नीचे लिखी जाती हैं और फ़ोकस लेने वाले सारांश में सूचीबद्ध होती हैं।

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

    समीक्षा तक कुछ भी ऑर्डर नहीं होता: वहाँ हर जवाब बदलें बटन के साथ दिखता है, और ऑर्डर सिर्फ़ उसी चरण से होता है।

  • 3.3.7 दोहराई गई एंट्री स्तर A

    पीछे जाने पर, या समीक्षा से कोई हिस्सा बदलने पर, पहले भरा सब कुछ बना रहता है; कुछ भी दोबारा टाइप नहीं करना पड़ता।

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

    मौजूदा चरण पर aria-current="step" है, और पूरे हुए चरण सिर्फ़ टिक से नहीं, शब्दों में पूरा कहते हैं।

उपयोग

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

इसे अपनाएँ

  • ऐसे लंबे काम जो साफ़ हिस्सों में बँटते हैं, जैसे चेकआउट, आवेदन या खाता सेट करना।
  • ऐसे सवाल जिनके जवाब तय करते हैं कि आगे क्या आएगा, इसलिए उन्हें एक-एक हिस्से में पूछने से हर स्क्रीन छोटी रहती है।

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

  • एक स्क्रीन में समाने वाले छोटे फ़ॉर्म: उन्हें बाँटने से क्लिक बढ़ते हैं और अंत नज़र से छिप जाता है।
  • ऐसे हिस्से जिन्हें ठीक जवाब देने के लिए साथ-साथ देखना ज़रूरी है: उन्हें एक ही पेज पर रखें।
  • ऐसे चरण जो किसी भी क्रम में हो सकते हैं: उनकी जगह टैब या हेडिंग वाले सेक्शन इस्तेमाल करें।

आम विफलताएँ

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

  • फ़ोकस आगे बढ़ें बटन पर ही छूट जाना

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

  • प्रगति सिर्फ़ रंग से दिखाना

    थोड़े अलग रंग का भरा गोला बहुत से लोगों को कुछ नहीं बताता। यहाँ पूरे हुए चरणों पर टिक और पूरा शब्द है, और मौजूदा चरण aria-current="step" से चिह्नित है।

  • पीछे जाने पर जवाब खो जाना

    किसी के पीछे जाने पर चरण साफ़ कर देने से उसे सब दोबारा टाइप करना पड़ता है। यहाँ चरण सिर्फ़ छिपाए जाते हैं, इसलिए हर जवाब बना रहता है।

  • त्रुटियाँ सिर्फ़ आख़िर में पकड़ना

    आख़िरी चरण पर सब कुछ जाँचने से लोगों को समस्या ढूँढने के लिए हर स्क्रीन से होकर वापस जाना पड़ता है। यहाँ आगे बढ़ने से पहले हर चरण जाँचा जाता है।

  • ऑर्डर से पहले जाँचने का कोई तरीका नहीं

    भुगतान के चरण से सीधे ऑर्डर कर देने पर गलत पता पकड़ने का मौका नहीं मिलता। समीक्षा हर जवाब को बदलें बटन के साथ दिखाती है।

  • क्लिक होने वाले चरण संकेतक

    प्रगति सूची के चरण अगर लिंक की तरह काम करें तो लोग बिना जाँचे चरण छोड़ सकते हैं और सूची को दो काम मिल जाते हैं। यहाँ वह सिर्फ़ प्रगति दिखाती है; आना-जाना पीछे, आगे बढ़ें और बदलें से होता है।

नोट्स

इसे बनाना

  • हेडिंग legend के अंदर है, इसलिए वह fieldset को नाम देती है और स्क्रीन रीडर की हेडिंग सूची में भी दिखती है। उस पर tabindex="-1" है ताकि स्क्रिप्ट बिना नया Tab पड़ाव जोड़े उस पर फ़ोकस कर सके।
  • आगे बढ़ें फ़ॉर्म का submit बटन है, इसलिए किसी भी फ़ील्ड में Enter आगे ले जाता है, और जाँच एक ही जगह चलती है। पीछे type="button" है, इसलिए वह कभी फ़ॉर्म नहीं भेजता।
  • समीक्षा से बदलें के बाद आगे बढ़ें पर सहेजें और समीक्षा पर लौटें लिखा आता है और वह सीधे वापस ले जाता है, ताकि छोटे सुधार के लिए फिर हर चरण से न गुज़रना पड़े।
  • जिस साइट पर हर चरण अलग पेज है, वहाँ भी यही हिस्से रखें: पेज शीर्षक और हेडिंग में चरण, पीछे का लिंक, और समीक्षा के बदलें लिंक।
  • कुल रकम जवाबों से निकाली जाती है और अपने अलग एलिमेंट में संख्या के रूप में लिखी जाती है, ताकि आसपास के शब्द अपने आप अनुवाद हो सकें।

स्रोत: WAI ट्यूटोरियल: कई पेज वाले फ़ॉर्म · WAI ट्यूटोरियल: कंट्रोल को समूह में रखना · एचटीएमएल: legend एलिमेंट

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