- To automatically save form data
- To make a suitable element focusable in the normal sequential keyboard navigation order
- To hide an element from assistive technology
- To apply a CSS class to the element
Correct answer: B
- A — Incorrect: tabindex does not save data.
- B — Correct: tabindex="0" can include an otherwise non-focusable element in the normal sequential focus order, but keyboard behavior must still be implemented where needed.
- C — Incorrect: tabindex does not hide content from assistive technology.
- D — Incorrect: CSS classes are assigned through the class attribute.
Question 10: Which statement about data attributes and security is correct?
- Data attributes are always hidden from users
- Data attributes can securely store passwords
- Users can inspect and modify data attributes, so sensitive operations require server-side validation
- Data attributes automatically validate product prices
Correct answer: C
- A — Incorrect: Data attributes can be inspected through page source or browser Developer Tools.
- B — Incorrect: They are not secure storage for passwords or secrets.
- C — Correct: Client-side values can be changed, so the server must validate prices, permissions, ownership, and sensitive operations.
- D — Incorrect: Data attributes only store values; they do not automatically validate business rules.
13. Final Checklist
Before moving to Section 6, make sure you can:
- Explain what global attributes are.
- Use IDs for unique identification and classes for reusable styling or behavior.
- Use CSS ID and class selectors correctly.
- Read and write data attributes using JavaScript's dataset property.
- Convert data attribute strings into appropriate JavaScript data types.
- Use contenteditable for basic editable regions and understand its limitations.
- Explain the purposes of title, lang, dir, hidden, tabindex, spellcheck, draggable, and translate.
- Recognize that hidden elements and data attributes do not provide security.
- Use browser Developer Tools to inspect attributes and DOM changes.
Next section: Section 6 — Comments, Entities, Unicode and Special Characters.
End of Section 5 — Codementrix HTML5 Mastery.