Skip to content

Fix page publication fields not clearing when unchecking published checkbox#3737

Open
antwertinger wants to merge 1 commit intoAlchemyCMS:mainfrom
foureb:fix-clear-page-publication
Open

Fix page publication fields not clearing when unchecking published checkbox#3737
antwertinger wants to merge 1 commit intoAlchemyCMS:mainfrom
foureb:fix-clear-page-publication

Conversation

@antwertinger
Copy link
Contributor

What is this pull request for?

When unchecking the "published" checkbox on a page that already has a public_on date set, the page remained published after saving. The root cause was that the code set input.value = "" directly on the raw element, which flatpickr ignores — it uses its own internal state for form submission.

Fix: query the web component instead of the raw input and call flatpickr.clear() to correctly reset both the DOM value and flatpickr's internal state.

Notable changes (remove if none)

  • page_publication_fields.js now selects alchemy-datepicker elements via :has() selector instead of the inner directly
  • Uses flatpickr.clear() instead of input.value = "" to properly clear the datepicker state on uncheck

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@antwertinger antwertinger requested a review from a team as a code owner March 11, 2026 08:57
@codecov
Copy link

codecov bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.47%. Comparing base (a5e74a4) to head (43ce4ac).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3737   +/-   ##
=======================================
  Coverage   97.47%   97.47%           
=======================================
  Files         314      314           
  Lines        8303     8303           
=======================================
  Hits         8093     8093           
  Misses        210      210           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@antwertinger antwertinger force-pushed the fix-clear-page-publication branch from f4be71c to 43ce4ac Compare March 11, 2026 12:00
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.

1 participant