Accessibility and Frontend Security — Concept Check
Questions on Accessibility and Frontend Security. Semantic HTML gets you most of accessibility for free, and most XSS comes from one habit. Both are asked in interviews and both are visible in code review.
Questions in this quiz
8 questions on Accessibility and Frontend Security — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You have a clickable div that needs to behave like a button. Which attribute is NOT necessary to achieve this?
- AonKeyDown handler
- Brole="button"
- Caria-label="Button"
- DtabIndex={0}
2.A developer uses `element.innerHTML = comment` to display user comments. What is the risk?
- AIt leads to performance issues.
- BIt will not display HTML tags correctly.
- CIt can cause CSRF attacks.
- DIt may cause XSS vulnerabilities.
3.Which of the following is a safe way to render user-generated HTML content?
- AUsing innerHTML directly
- BUsing DOMPurify to sanitize before rendering
- CRendering as plain text with textContent
- DUsing dangerouslySetInnerHTML without sanitization
4.In a form, why is it important to have a label associated with every input?
- ATo improve styling consistency
- BTo ensure accessibility for screen readers
- CTo enhance form validation
- DTo increase loading speed
5.When should ARIA attributes be used in web development?
- ATo replace native HTML elements
- BAlways, to enhance accessibility
- COnly when native HTML elements cannot provide the required functionality
- DTo simplify CSS styling
6.A developer removes the focus ring from all elements for aesthetic reasons. What is the consequence?
- ABroken keyboard navigation
- BIncreased accessibility
- CEnhanced visual appeal
- DImproved performance
7.Which HTTP header helps prevent MIME type sniffing?
- AContent-Security-Policy
- BStrict-Transport-Security
- CX-Content-Type-Options
- DReferrer-Policy
8.What is the primary purpose of setting `aria-live="polite"` on a status message?
- ATo announce updates without interrupting the user
- BTo enhance visual styling
- CTo ensure the message is read immediately
- DTo improve page load speed