Problem/Motivation
The height and contentHeight calendar settings are non-functional. The settings are added to the outer array of options for the calendar like this:
"fullcalendar":{"ID":{"height":"auto","contentHeight":"auto", ... ,"options":{"aspectRatio":"", ... }}}
Instead, they need to be added to the inner options array like this:
"fullcalendar":{"ID":{ ... ,"options":{"aspectRatio":"","height":"auto","contentHeight":"auto", ... }}}
Steps to reproduce
In a FullCalendar view's "Calendar Appearance/Sizing" settings set the "Width-height ratio" to an empty value. Then try to set values for the "Height" and "View area height". They have no effect. Check the drupalSettings JSON and see that the height settings are not added to the options array.
Drupal\fullcalendar\Plugin\fullcalendar\type\FullCalendar::preView() performs validation and data normalization on the settings. It decides how to normalize based on values obtained from OptionsFormHelperTrait::getCalendarProperties(). If an option isn't set up in getCalendarProperties(), then the normalization ignores the setting (there's no default case in the switch statement on line 1435) and it doesn't get added to the calendar options.
Proposed resolution
Add height and contentHeight to the getCalendarProperties() array so they get processed properly as options.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork fullcalendar-3499954
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
erutan commentedThe ratio values are just being passed into fullcalendar via it's API... that's how the JS works under the hood.
https://fullcalendar.io/docs/sizing
If you haven't figured this out yet, looking a bit wider the issue in fullcalendar itself (vs this drupal bridge / contrib) could be useful. Perhaps loading contentHeight as well as height would work via custom JS, or make a patch to include contentHeight in the UI?
Comment #3
mortona2k commentedI'm seeing a vertical scroll when the month view is at a narrow width. If I set the ratio low, like .5, it stretches it out too long.
More clarity/control over this would be much appreciated.
Comment #4
dcam commentedIt seems like the original reporter of this issue didn't realize they found a bug, but they described it fairly well in the summary:
I discovered it for the same reason: I needed to remove the scrollbar inside the calendar. I have to do it for accessibility reasons. After a while of struggling with it I realized that it's because the
heightandcontentHeightsettings are not added to theoptionsarray in the JS settings. So I'm repurposing this issue to deal with the bug.Comment #6
dcam commentedI even added a Unit test. Its provider can be extended later with test cases for other options.
Comment #7
mortona2k commentedQuick test - setting height and contentHeight to auto gets rid of the constrained height and double scrollbars I was seeing.