Limit Event description field to 200 characters (#1099) - #1150
Conversation
Long event descriptions overflow the event preview UI. Cap the Events `description` textarea at 200 characters via Payload's maxLength (enforced in the admin and on save) and update the field's admin description to "Short description/summary for event previews. Limit 200 characters." No migration: maxLength is validation-only and does not change the SQLite column (migrate:create reports no schema changes). The regenerated payload-types.ts picks up the new field description as a JSDoc comment. Fixes #1099 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016s7MJjeP8Mr3KRiRA22WwJ
|
Preview deployment: https://claudexevent-description-limit-1099.preview.avy-fx.org |
The doc doesn't document field validation limits, so it remains accurate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
@rustynwac Heads up before this merges: 32 published events currently in production already have descriptions longer than 200 characters. Nothing breaks retroactively — those events keep displaying fine and draft saves still work — but the next time someone edits and publishes one of them, it'll fail validation until the description is trimmed under 200. See those here. If that's acceptable then cool - just want an explicit 👍 knowing the impact. One more wrinkle: Payload doesn't render a live character counter on this field, so editors only find out via the helper text or the validation error at publish time. Should we add a character counter? |
|
Fine on historical events. I figured that would be the case. If the validation error is explicit then that's good enough for now I think! |
`maxLength: 200` is validation-only and Payload renders no counter, so editors had no way to see how close they were to the limit until publishing failed. Add a `DescriptionWithCharCount` field description component that appends a live "used/allowed characters" count to the field's own `admin.description`, and wire it into the Events `description` field. The component reads both the helper text and the limit off the field config, so it drops onto any textarea with a `maxLength` — Courses `description` next, if that field gets the same cap. Once the value goes over the limit the counter picks up the admin's `.text-error` class, which is theme-aware. The field's `admin.description` loses its now-redundant "Limit 200 characters." sentence, which is what changes the JSDoc comment in payload-types.ts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Added a live character counter under the Description field so the 200-character cap is visible while typing instead of only surfacing as a validation error on publish.
@rustynwac — worth re-checking on the preview deployment once it rebuilds. Note this does not change the production-content picture: |

Description
Long event descriptions overflow the event preview UI (see #1099). This caps the Events
descriptionfield at 200 characters and updates the field's admin helper text so editors know the limit up front.Related Issues
Fixes #1099
Key Changes
src/collections/Events/index.ts— addmaxLength: 200to thedescriptiontextarea and change its admin description from"Short description/summary for event previews"to"Short description/summary for event previews. Limit 200 characters.". Payload enforcesmaxLengthboth in the admin UI and on save (Local/REST API).src/payload-types.ts— regenerated; the field's admin description flows through as the JSDoc comment onEvent.description.How to test
pnpm seed, openlocalhost:3000/admin, create/edit an Event.Automated / verification:
pnpm tsc,pnpm lint,pnpm test(525 passing),pnpm fallow:audit— all clean.pnpm payload migrate:createreports no schema changes (maxLength is validation-only; the SQLite column is unchanged), so no migration is included.The following field is invalid: Description).Screenshots
Over the limit, dark theme — the counter turns red:
Over the limit, light theme — same state, theme-aware color:
Within the limit, dark theme:
Within the limit, light theme:
Migration Explanation
None required —
maxLengthadds validation only and does not alter the database schema.Future enhancements / Questions
Coursescollection has adescriptionfield with the same original helper text but was left unchanged, since this issue is specifically about Events. Happy to apply the same cap there if wanted.docs/events-and-courses.mdis drift-bound toEvents/index.ts, so the drift check will flag it as stale from this change. The doc prose is still accurate (it listsdescriptionas a field but doesn't document length constraints), so it just needs a re-link:drift link docs/events-and-courses.md src/collections/Events/index.ts --doc-is-still-accurate. I couldn't run this in my environment because thedriftbinary isn't installed there and couldn't be fetched.🤖 Generated with Claude Code
https://claude.ai/code/session_016s7MJjeP8Mr3KRiRA22WwJ
Generated by Claude Code
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.