Skip to content

fix(sitemap-admin): dialog cleanup, accessibility, and UX fixes#280

Merged
shsteimer merged 3 commits intomainfrom
fix/sitemap-admin-cleanup
Apr 14, 2026
Merged

fix(sitemap-admin): dialog cleanup, accessibility, and UX fixes#280
shsteimer merged 3 commits intomainfrom
fix/sitemap-admin-cleanup

Conversation

@shsteimer
Copy link
Copy Markdown
Collaborator

@shsteimer shsteimer commented Apr 7, 2026

Summary

Part 1 of 2 replacing #252, which combined cleanup/fixes with new features. This PR contains only the fixes and cleanup; the sitemap index definition viewer will follow in a separate PR.

  • Extract cleanupDialog/registerDialogCleanup helpers so dialogs are properly removed on close, cancel, and Escape
  • Add aria-labelledby to all dialog templates for screen reader support
  • Fix 204 response handling in generateSitemap to avoid calling resp.json() on empty body
  • Wrap generate button reset in try/finally so it recovers on errors
  • Deduplicate YAML import into ensureYaml() helper
  • Fix CSS specificity for type dialog button area
  • Auto-submit form when org/site query params are present

Preview: https://fix-sitemap-admin-cleanup--helix-tools-website--adobe.aem.page/tools/sitemap-admin/index.html

Test plan

  • Dismiss each sitemap dialog via Escape, then reopen it and verify a fresh dialog opens correctly
  • Dismiss each dialog via cancel button and backdrop click, then verify reopening still works
  • Verify all dialogs expose the correct accessible name from their headings (check with screen reader or dev tools)
  • Verify the type-selection dialog cancel area is laid out correctly
  • Generate a sitemap for a configured destination and verify success
  • Generate a sitemap for a path that is not a configured destination and verify the 204 response is handled gracefully without leaving the button disabled
  • Load the page with ?org=<org>&site=<site> and verify the form auto-submits

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

Extract cleanupDialog/registerDialogCleanup helpers so dialogs are
properly removed on close, cancel, and Escape. Use :last-of-type
selectors to avoid stale dialog references. Add aria-labelledby to
all dialog templates for screen reader support. Fix 204 response
handling in generateSitemap to avoid calling resp.json() on empty
body. Wrap generate button reset in try/finally. Deduplicate YAML
import into ensureYaml(). Fix CSS specificity for type dialog button
area. Auto-submit form when org/site query params are present.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aem-code-sync
Copy link
Copy Markdown

aem-code-sync bot commented Apr 7, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@aem-code-sync
Copy link
Copy Markdown

aem-code-sync bot commented Apr 7, 2026

Page Scores Audits Google
📱 /tools/sitemap-admin/index.html PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /tools/sitemap-admin/index.html PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

registerDialogCleanup already ensures stale dialogs are removed from
the DOM, so :last-of-type guards are redundant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aem-code-sync aem-code-sync bot temporarily deployed to fix/sitemap-admin-cleanup April 7, 2026 14:24 Inactive
@shsteimer shsteimer requested a review from usman-khalid April 7, 2026 14:35
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 8, 2026

Code Review

Files Reviewed

  • tools/sitemap-admin/index.html
  • tools/sitemap-admin/sitemap-admin.css
  • tools/sitemap-admin/sitemap-admin.js

Issues Found

None. Checked for bugs, CLAUDE.md compliance, and EDS-specific criteria (JS patterns, CSS scoping, accessibility, security, performance).

Highlights

  • 204 fix — correctly guards against calling .json() on an empty response body; logic is sound
  • Dialog cleanupcleanupDialog + registerDialogCleanup correctly handle Escape-key dismiss; double .remove() calls on detached elements are harmless no-ops
  • Accessibilityaria-labelledby additions correctly associate each <dialog> with its <h3> heading; IDs inside <template> elements don't create live DOM duplicates
  • CSS scoping.sitemap-type-button-area remains properly scoped via CSS nesting inside .sitemap-admin
  • ensureYaml() — deduplication is correct; any concurrent-call race results only in a redundant (harmless) dynamic import
  • Auto-submitrequestSubmit() fires after the submit listener is registered and only when both org and site values are populated; submit handler has its own guard

Verdict

APPROVE

@shsteimer shsteimer merged commit 1c6b06e into main Apr 14, 2026
5 of 6 checks passed
@shsteimer shsteimer deleted the fix/sitemap-admin-cleanup branch April 14, 2026 16:36
usman-khalid pushed a commit that referenced this pull request Apr 15, 2026
* fix(sitemap-admin): dialog cleanup, accessibility, and UX fixes

Extract cleanupDialog/registerDialogCleanup helpers so dialogs are
properly removed on close, cancel, and Escape. Use :last-of-type
selectors to avoid stale dialog references. Add aria-labelledby to
all dialog templates for screen reader support. Fix 204 response
handling in generateSitemap to avoid calling resp.json() on empty
body. Wrap generate button reset in try/finally. Deduplicate YAML
import into ensureYaml(). Fix CSS specificity for type dialog button
area. Auto-submit form when org/site query params are present.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(sitemap-admin): remove unnecessary :last-of-type dialog selectors

registerDialogCleanup already ensures stale dialogs are removed from
the DOM, so :last-of-type guards are redundant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants