fix(input): exclude date inputs from scroll assist (#25749)

resolves #25745
This commit is contained in:
Liam DeBeasi
2022-08-11 10:43:53 -05:00
committed by GitHub
parent d0ba963599
commit abb56d22b4

View File

@@ -41,7 +41,20 @@ export const startInputShims = (config: Config) => {
hideCaretMap.set(componentEl, rmFn);
}
if (SCROLL_ASSIST && (!!scrollEl || !!footerEl) && scrollAssist && !scrollAssistMap.has(componentEl)) {
/**
* date/datetime-locale inputs on mobile devices show date picker
* overlays instead of keyboards. As a result, scroll assist is
* not needed. This also works around a bug in iOS <16 where
* scroll assist causes the browser to lock up. See FW-1997.
*/
const isDateInput = inputEl.type === 'date' || inputEl.type === 'datetime-local';
if (
SCROLL_ASSIST &&
!isDateInput &&
(!!scrollEl || !!footerEl) &&
scrollAssist &&
!scrollAssistMap.has(componentEl)
) {
const rmFn = enableScrollAssist(componentEl, inputEl, scrollEl, footerEl, keyboardHeight);
scrollAssistMap.set(componentEl, rmFn);
}