Skip to content

fix(admin): accept relative URLs in menu editor - #349

Merged
ascorbic merged 7 commits into
emdash-cms:mainfrom
tsikatawill:fix/menu-editor-relative-urls
Apr 11, 2026
Merged

fix(admin): accept relative URLs in menu editor#349
ascorbic merged 7 commits into
emdash-cms:mainfrom
tsikatawill:fix/menu-editor-relative-urls

Conversation

@tsikatawill

Copy link
Copy Markdown
Contributor

What does this PR do?

The menu editor's URL input used type="url", which triggers browser validation requiring a full URL with scheme. This rejected relative paths like /about or /blog, which are the most common use case for internal menu links.

Changes type="url" to type="text" with a pattern attribute that accepts:

  • Absolute URLs: https://example.com, http://example.com/path
  • Relative paths: /about, /blog/post-1, /

And rejects invalid values like bare domains (example.com) or schemeless input (about).

Both the add form and edit form inputs are updated.

Closes #342

Type of change

  • Bug fix
  • Feature (requires approved Discussion)
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm --silent lint:json | jq '.diagnostics | length' returns 0
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/...

AI-generated code disclosure

  • This PR includes AI-generated code

Screenshots / test output

 ✓ URL input accepts relative paths
 ✓ URL input accepts absolute https URLs
 ✓ URL input rejects bare domains without scheme
Change URL inputs from type="url" to type="text" with a pattern
that accepts absolute URLs (https://...) and relative paths (/...).
Browser validation on type="url" rejected relative paths like /about,
which are the most common use case for menu items.

Closes emdash-cms#342
@changeset-bot

changeset-bot Bot commented Apr 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 780713e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-ai-moderation Patch
@emdash-cms/plugin-atproto Patch
@emdash-cms/plugin-audit-log Patch
@emdash-cms/plugin-color Patch
@emdash-cms/plugin-embeds Patch
@emdash-cms/plugin-forms Patch
@emdash-cms/plugin-webhook-notifier Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added size/M and removed size/S labels Apr 7, 2026
@pkg-pr-new

pkg-pr-new Bot commented Apr 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@349

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@349

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@349

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@349

emdash

npm i https://pkg.pr.new/emdash@349

create-emdash

npm i https://pkg.pr.new/create-emdash@349

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@349

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@349

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@349

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@349

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@349

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@349

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@349

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@349

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@349

commit: 780713e

@ascorbic ascorbic left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this was fixed in another PR, but the form updates are a good fix so I'll merge this too

@ascorbic
ascorbic enabled auto-merge (squash) April 11, 2026 11:47
@github-actions github-actions Bot added size/S and removed size/M labels Apr 11, 2026
@ascorbic
ascorbic merged commit 53dec88 into emdash-cms:main Apr 11, 2026
25 checks passed
This was referenced Apr 11, 2026
fmhall pushed a commit to fmhall/emdash that referenced this pull request Apr 13, 2026
* fix(admin): accept relative URLs in menu editor

Change URL inputs from type="url" to type="text" with a pattern
that accepts absolute URLs (https://...) and relative paths (/...).
Browser validation on type="url" rejected relative paths like /about,
which are the most common use case for menu items.

Closes emdash-cms#342

* Add changeset for menu editor URL fix

---------

Co-authored-by: Matt Kane <mkane@cloudflare.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment