Skip to content

Commit

Permalink
fix #188: prevent flickering also for date/time-picker
Browse files Browse the repository at this point in the history
  • Loading branch information
jrief committed Jan 22, 2025
1 parent a6fc0b2 commit 55c66df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions client/django-formset/DateTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@ class DateTimeField extends Widget {
}

public initialize() {
if (this.calendar) {
// to prevent flickering when loading the page, the popup dialog is hidden
this.calendar.element.style.visibility = '';
}

// some styles change when switching light/dark mode, so we need to update them
StyleHelpers.pushMediaQueryStyles([[
this.styleSheet,
Expand Down
2 changes: 1 addition & 1 deletion formset/templates/formset/default/widgets/datetime.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% include "django/forms/widgets/input.html" %}
{% if calendar %}
<div role="dialog" class="dj-calendar" aria-label="calendar">
<div role="dialog" class="dj-calendar" aria-label="calendar" style="visibility: hidden;">
{% include calendar.template %}
</div>
{% endif %}

0 comments on commit 55c66df

Please sign in to comment.