我在react中使用iframe加载了一个url。 使用 iframe,加载的 src 有一个文本字段。当尝试在该文本字段中输入内容时,设备键盘会隐藏该文本字段。
如果在没有 Iframe 的情况下加载相同的 url,则工作正常,文本字段始终进入视图。
<iframe
title="Task Details Page"
src="https://dev.storeintegrity.a-kmtkmg.net/products/details/details?exceptionId=1722"
style={{
width: '100%',
height: '100%',
border: 'none',
}}
></iframe>```
Even on the src side (which is getting loaded within iframe) a added a focus event on the Text field
//notesInputRef.current?.scrollIntoView({ block: 'center' });
//window.scrollTo(0, notesInputRef.current?.offsetTop ?? 0);
tried both things
尝试将
window.scrollTo()
更改为 top.scrollTo()
,因为您需要在父页面上运行它,而不是在 iFrame 中。