[{"id":"webaccessibilityadvanced-001","courseId":"web-accessibility-advanced","domain":"semantic-html","topic":"Connecting a caption to a text field","prompt":"A signup form has a visible caption, 'Email address', above a text field. Which TWO markup patterns connect the caption to the field so a screen reader announces it when the field is focused?","hint":"The link comes from an id-based attribute or from one element containing the other.","explain":"A caption and a field are separate elements, so the markup must state the link between them. Browsers recognise a few ways to state it, each relying on exact attribute values or on how the elements nest.","source":"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"Nest the input inside the label element","why":"Nesting the input inside its label is an implicit association, so the label text is tied to the field."},{"id":"b","text":"Give the input an id and set the label's for attribute to that same id","why":"This explicit association is the form the page recommends for compatibility with assistive technology."},{"id":"c","text":"Set the label's for attribute to the input's name attribute","whyNot":"The for value must match an id; the name attribute plays no part in this association."},{"id":"d","text":"Put the label element directly before the input, with no attributes","whyNot":"Position alone does not link them; the only ways named are a matching for and id, or nesting."},{"id":"e","text":"Give the label and the input the same class name","whyNot":"Class names do not create the association; only a matching for and id, or nesting, does."},{"id":"f","text":"Add a for attribute to the input whose value is the label's id","whyNot":"The for attribute belongs on the label and holds the id of the input, not the other way round."}],"answer":"ab","explanation":"A label is tied to a field either by nesting the field inside it (implicit) or by a for attribute on the label whose value matches the field's id (explicit). MDN recommends the explicit form for compatibility with assistive technology.","concept":"A label is tied to a field either by nesting the field inside it (implicit) or by a for attribute on the label whose value matches the field's id (explicit). MDN recommends the explicit form for compatibility with assistive technology.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["A caption links to a field only through a matching for and id, or by nesting the field inside the caption."]},{"id":"webaccessibilityadvanced-002","courseId":"web-accessibility-advanced","domain":"semantic-html","topic":"Button default action inside a form","prompt":"A checkout form has a button labelled 'Apply coupon' that should only refresh the price on the page. The button sits inside the form element and has no type attribute. What happens when a shopper presses it?","hint":"A button's action comes from a setting whose default depends on whether the button sits inside a form.","explain":"An attribute decides what a button does, and a missing attribute falls back to a default. That default can depend on the container the button sits in, so identical markup may act differently.","source":"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button","interaction":{"type":"single"},"options":[{"id":"a","text":"It submits the form to the server","why":"With no type set, a button inside a form defaults to submit, which sends the form data to the server."},{"id":"b","text":"It does nothing unless a script is attached to it","whyNot":"Inside a form, a button with no type acts by default, so it submits even without any script."},{"id":"c","text":"It resets every field to its starting value","whyNot":"The default for a button inside a form is submit, not reset."},{"id":"d","text":"It turns into a link to the form's action address","whyNot":"A button does not become a link; inside a form its default is submit."}],"answer":"a","explanation":"A button with no type attribute inside a form defaults to submit and sends the form data. Buttons that only run script should set the type to button so they do not submit.","concept":"A button with no type attribute inside a form defaults to submit and sends the form data. Buttons that only run script should set the type to button so they do not submit.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Inside a form, a button with no type submits; give script-only buttons type button."]},{"id":"webaccessibilityadvanced-003","courseId":"web-accessibility-advanced","domain":"semantic-html","topic":"Grouping related radio buttons","prompt":"A form asks 'How should we contact you?' and offers four radio buttons: email, phone, post and text message. Which markup gives assistive technology the question as a caption for the whole set?","hint":"Think about which HTML element is meant to hold a set of related form controls.","explain":"Several controls that answer one question form a unit. Assistive technology reads each control in turn, so the markup needs a way to tell the user what the whole unit is asking.","source":"https://www.w3.org/WAI/tutorials/forms/grouping/","interaction":{"type":"single"},"options":[{"id":"a","text":"Wrap the four radio buttons in a fieldset with a legend that asks the question","why":"Radio groups should always be grouped with a fieldset, and the legend gives the group its caption."},{"id":"b","text":"Give each radio its own label and skip any grouping element","whyNot":"Each label names one button; the grouping for a radio set is still a fieldset."},{"id":"c","text":"Put the question in a heading above the buttons, with no grouping element","whyNot":"A heading sits outside the controls, so the set itself gets no grouping and no caption."},{"id":"d","text":"Give all four radio buttons the same id so they count as one control","whyNot":"An id should name one element, and sharing one does not group the buttons; a fieldset does."}],"answer":"a","explanation":"Radio buttons that answer one question should always be grouped in a fieldset. The legend supplies the caption, and some screen readers announce it with each control in the group.","concept":"Radio buttons that answer one question should always be grouped in a fieldset. The legend supplies the caption, and some screen readers announce it with each control in the group.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Radio buttons that answer one question belong in a fieldset, with a legend as their caption."]},{"id":"webaccessibilityadvanced-004","courseId":"web-accessibility-advanced","domain":"semantic-html","topic":"Header element as a landmark","prompt":"A blog post is wrapped in an article element, and its title block is a header element placed at the top of that article. Does this header expose a banner landmark to assistive technology?","hint":"The role a header gets depends on what surrounds it, not on what it contains.","explain":"Structural elements expose a role for navigation, and that role is not fixed per element type. Surrounding elements can change it, so one element may be presented differently in different places.","source":"https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/header","interaction":{"type":"single"},"options":[{"id":"a","text":"No, inside an article it is exposed as generic and is not a landmark","why":"Inside article, aside, main, nav or section, a header takes the generic role and loses its landmark status."},{"id":"b","text":"Yes, every header element is exposed as a banner landmark","whyNot":"The banner role applies only when the header's context is the body, not inside an article."},{"id":"c","text":"Yes, as long as the header contains a heading element","whyNot":"The role comes from the header's context, not from the heading elements it may contain."},{"id":"d","text":"No, an article element cannot contain a header element at all","whyNot":"A header may sit inside an article; it only loses its landmark status there."}],"answer":"a","explanation":"A header is a banner landmark when its context is the body. Nested inside article, aside, main, nav or section, it has the generic role and is no longer a landmark.","concept":"A header is a banner landmark when its context is the body. Nested inside article, aside, main, nav or section, it has the generic role and is no longer a landmark.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["A header is a banner landmark only at body level; inside article, section or similar it is generic."]},{"id":"webaccessibilityadvanced-005","courseId":"web-accessibility-advanced","domain":"semantic-html","topic":"Label for attribute with duplicate ids","prompt":"A page has a label with for='zip' placed above two inputs. Both inputs were copied from a template and both carry id='zip'. Which input does the label name?","hint":"Consider what the browser does when an id reference matches more than one element.","explain":"An id is meant to name one element, yet markup can repeat it, so a reference must settle on a single target. The choice follows a rule in how labels are defined.","source":"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label","interaction":{"type":"single"},"options":[{"id":"a","text":"The first input in the document that carries that id","why":"The for value points at the first element with the matching id; later matches are not considered."},{"id":"b","text":"The last input in the document with that id, since later ones overwrite earlier ones","whyNot":"The page says later matches are not considered, so the last one is not chosen."},{"id":"c","text":"Both inputs, since a label can be attached to several controls at once","whyNot":"Several labels may point at one control, but one for value names only one target."},{"id":"d","text":"Neither input, because a duplicate id makes the label invalid for both","whyNot":"The first matching element still counts as the labeled control; duplicates do not cancel it."}],"answer":"a","explanation":"A label's for attribute matches the first element in the document with that id, if that element is labelable; later duplicates are not considered. Several labels may share one control.","concept":"A label's for attribute matches the first element in the document with that id, if that element is labelable; later duplicates are not considered. Several labels may share one control.","rev":1,"updatedAt":"2026-10-26","kind":"scenario","takeaways":["Duplicate ids make label links unreliable: the first matching element wins and the rest are not considered."]}]