Premium
Modal: Native <dialog> Confirm (Accessible Naming)
Build a native confirm dialog for deleting a project using the HTML element. The dialog must be accessible (proper name + description) and must be visible in the preview without JavaScript. Only edit HTML. Do not change CSS.
What you’ll build / What this tests
This premium html coding focuses on Modal: Native Confirm (Accessible Naming). You’ll apply accessibility and aria-describedby thinking with hard level constraints. The prompt emphasizes Build a native confirm dialog for deleting a project using the HTML <dialog> element. The dialog….
Learning goals
- Translate the prompt into a clear html API signature and return shape.
- Apply accessibility, aria-describedby, aria-labelledby techniques to implement modal: native confirm (accessible naming).
- Handle hard edge cases without sacrificing readability.
- Reason about time/space complexity and trade-offs in html.
Key decisions to discuss
- Define the exact input/output contract before coding.
- Prioritize predictable edge-case handling over micro-optimizations.
Evaluation rubric
- Correctness: covers required behaviors and edge cases.
- Clarity: readable structure and predictable control flow.
- Complexity: avoids unnecessary work for large inputs.
- API discipline: no mutation of inputs; returns expected shape.
- Testability: solution is easy to unit test.
Constraints / Requirements
- Handle empty or missing inputs without throwing errors.
- Keep runtime close to linear time where possible.
- Prefer a pure function: no side effects beyond the return value.
- Be explicit about edge cases and error states.
- Prioritize clarity over cleverness in explanations.
- Explain the trade-offs behind your choices.
Mini snippet (usage only)
// Example usage
const <dialog open> = /* modal: native <dialog> confirm (accessible naming) input */;
const aria-labelledby = /* config */;
const result = solve(<dialog open>, aria-labelledby);
console.log(result);
// Edge case check
const empty = <dialog open> && aria-labelledby ?? null;
const fallback = solve(<dialog open>, aria-labelledby);
console.log(fallback);
// Expected: describe output shape, not the implementation
// (no solution code in preview)Common pitfalls
- Mutating inputs instead of returning a new value.
- Skipping edge cases like empty input, duplicates, or nulls.
- Overlooking time complexity for large inputs.
Related questions
Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.