Browse Source

Fix iOS Safari sticky input

master
Eduard Kuzmenko 3 years ago
parent
commit
260406a129
  1. 8
      src/helpers/dom/fixSafariStickyInput.ts

8
src/helpers/dom/fixSafariStickyInput.ts

@ -4,6 +4,8 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE * https://github.com/morethanwords/tweb/blob/master/LICENSE
*/ */
import { doubleRaf } from "../schedulers";
export default function fixSafariStickyInput(input: HTMLElement) { export default function fixSafariStickyInput(input: HTMLElement) {
input.style.transform = 'translateY(-99999px)'; input.style.transform = 'translateY(-99999px)';
/* input.style.position = 'fixed'; /* input.style.position = 'fixed';
@ -11,7 +13,8 @@ export default function fixSafariStickyInput(input: HTMLElement) {
input.style.left = '0'; */ input.style.left = '0'; */
input.focus(); input.focus();
setTimeout(() => { // setTimeout(() => {
doubleRaf().then(() => {
//fastSmoothScroll(findUpClassName(input, 'scrollable-y') || window as any, document.activeElement as HTMLElement, 'start', 4, undefined, FocusDirection.Static); //fastSmoothScroll(findUpClassName(input, 'scrollable-y') || window as any, document.activeElement as HTMLElement, 'start', 4, undefined, FocusDirection.Static);
/* input.style.position = ''; /* input.style.position = '';
input.style.top = ''; */ input.style.top = ''; */
@ -21,5 +24,6 @@ export default function fixSafariStickyInput(input: HTMLElement) {
/* setTimeout(() => { /* setTimeout(() => {
fastSmoothScroll(findUpClassName(input, 'scrollable-y') || window as any, document.activeElement as HTMLElement, 'start', 4); fastSmoothScroll(findUpClassName(input, 'scrollable-y') || window as any, document.activeElement as HTMLElement, 'start', 4);
}, 50); */ }, 50); */
}, 0); });
// }, 0);
} }

Loading…
Cancel
Save