After iOS 14 introduced the new calendar view, there is a weird behaviour in wkwevbiew: If you click a datetime input field while the keyboard is shown, then the entire web page will be pushed up even after you closed the calendar view.
Step to reproduce:
- Creating a webpage that has a text input field and a datetime picker input, and the content height is less than your screen height so the page should not scroll vertically in normal.
- Add a wkwebview in you iOS app, and load that webpage.
- Click the first text field, which should bring up the keyboard (make sure to show the full keyboard if you are using a simulator). After the keyboard is displayed, the page should be able to scroll vertically (which is expected since the whole page is pushed up by keyboard).
- If you simply dismiss the keyboard by clicking the Done button, then the page should return to normal (not scrollable, same as step 3).
- But if you keep the keyboard opened, then click the date time picker field (the field below the text field), you should see the calendar view and the keyboard is dismissed.
- Click OK to dismiss the calendar view, you will then find that the content of the page is pushed up and is now scrollable.
The demo can be found here: https://github.com/Noisyfox/ios14-webview-datepicker-issue
Here is a gif:
Is there a workaround for this issue?