Skip to content

feat: add Required toggle for task modal fields (#2420) - #2423

Open
andriyor wants to merge 2 commits into
callumalpass:mainfrom
andriyor:feat/required-modal-fields
Open

andriyor wants to merge 2 commits into
callumalpass:mainfrom
andriyor:feat/required-modal-fields

Conversation

@andriyor

@andriyor andriyor commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2420.

Depends on #2422. This branch currently includes its commit (fix: keep task modal open when save validation fails); without it the modal closes after the "required" notice and the form is lost. I'll rebase once #2422 is merged.

What it does

ModalFieldConfig.required existed but was marked "future use" and never read.

  • Settings → Modal fields: every field card except Title gets a Required switch (Title is always required).
  • Create and edit modals: saving is refused while a required field that is shown in that modal is empty, and a notice lists the empty fields (Fill in required fields: Contexts, Projects).
  • Empty means: blank text for details, contexts, tags and projects; a time estimate of 0; no subtasks, blocked-by or blocking items; an empty user field (a false boolean user field is not treated as empty).
  • Hidden or disabled fields are never enforced. Tasks created outside the modal (inline conversion, API, frontmatter) are not checked; this is noted in docs/settings/modal-fields.md.

Due, scheduled, priority and status live in the action bar rather than in Modal Fields, so they can't be marked required with this change.

Changes

  • src/modals/taskModalFieldConfig.ts: getMissingRequiredModalFields()
  • src/modals/TaskModal.ts: validateRequiredFields() and isModalFieldEmpty(), called from handleSave() in the create and edit modals
  • src/settings/components/FieldManagerComponent.ts: the switch
  • i18n: settings.modalFields.manager.required and modals.task.requiredFieldsMissing in all locales; manifest and state updated with npm run i18n:sync
  • Docs: docs/settings/modal-fields.md
  • Tests: tests/unit/modals/taskModalFieldConfig.test.ts (helper) and a Required modal fields (#2420) block in tests/unit/modals/TaskCreationModal.test.ts (save is blocked while a required core or user field is empty, saves once filled, hidden fields are not enforced)

Testing

  • npm run build, tsc, full npx jest (5475 passed), npm run i18n:verify
  • Checked manually in Obsidian 1.14.4 on macOS: the Required switch persists, and the create modal refuses to save with an empty required field, then saves once it is filled.

🤖 Generated with Claude Code

The Save button closed the modal as soon as handleSave() resolved, even
when it returned early on validation (e.g. empty title), discarding the
form. handleSave() now returns false on validation failure and the save
action skips the close callback in that case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andriyor
andriyor marked this pull request as ready for review October 24, 2026 12:43
ModalFieldConfig.required was declared "future use" and never read. Modal
Fields settings now show a Required switch on every field except Title
(always required). The create and edit modals refuse to save while a
required field shown in that modal is empty and list the empty fields in
a notice. Hidden or disabled fields are not enforced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@andriyor
andriyor force-pushed the feat/required-modal-fields branch from 62c7da3 to f4bccac Compare October 24, 2026 12:46
@andriyor
andriyor marked this pull request as draft October 24, 2026 12:46
@andriyor
andriyor marked this pull request as ready for review October 24, 2026 12:47

This branch has not been deployed

No deployments
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.

[FR]: Required toggle for task modal fields

1 participant