Andorid 设备键盘隐藏了 iframe 中的文本字段

问题描述 投票:0回答:1

我在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
iframe keyboard focus textfield
1个回答
0
投票

尝试将

window.scrollTo()
更改为
top.scrollTo()
,因为您需要在父页面上运行它,而不是在 iFrame 中。

© www.soinside.com 2019 - 2024. All rights reserved.