Datepicker calendar window is placed incorrectly if the field is at the bottom
ScoomaCat opened this issue · comments
Environment
Sonata packages
sonata-project/admin-bundle 4.21.1
sonata-project/doctrine-orm-admin-bundle 4.3.0
sonata-project/intl-bundle 2.11.2
Symfony packages
symfony/symfony v4.4.50
PHP version
PHP 8.0.1
Subject
Datepicker window is shown way below instead of being on top of the field.
Please notice the placement of the field: it's on the very bottom of the browser window. There is no space to open calendar below the field. So I expect it to appear on top of it. But instead when I click on the field seemingly nothing happens, and then after I scroll a bit more I see the following:
Please notice the placement of the calendar relative to the placement of input field. It's gone way below.
I use sonata DatePickerType or DateTimePickerType, both show such behavior.
Steps to reproduce
- Find a DatePickerType or DateTimePickerType field.
- Scroll the page until there is no more space to render calendar under the field
- Click on the field
- Scroll a bit more to see the field rendered incorrectly
Expected results
The calendar window is opened based on free space (on top if there is no space at the bottom, at the bottom if there is no space at top)
Actual results
The calendar window is always rendered at the bottom, and it's location is incorrect if there is no space.
I dont think there is much we can do. This might be an issue with a very outdated datepicker library, placed on form-extensions (another sonata library)
You might want to try with sonata-project/form-extensions 2.0 since we updated that datepicker to its latest release. However a lot of options for the date picker have changed, and you will need at least Symfony 5.4 to update