单击时如何将专注于选择?
单击材料时,ui在iframe中每次都会在页面顶部选择滚动。
我在React应用程序上创建了一个月和年的选项。当我单击“选择按钮”时,它会自动滚动到页面顶部,这很烦人 当我仅在IFRAME内加载React应用程序时,就会发生此问题。 没有iframe,它可以正常工作
<Select
variant="outlined"
IconComponent={KeyboardArrowDown}
labelId="demo-simple-select-label"
style={{ marginRight: "10px", fontSize: Theme.typography.caption.fontSize}}
placeholder={Content?.expiryMonthPlaceHolder}
id="expirationMonth"
value={expirationMonth}
label="MM"
className={classes.cardmonth}
// expirationMonth ? classes.cardmonth : classes.cardmonthEmpty
// }
onChange={e => {
setExpirationMonth(e.target.value);
}}
>
{months.map(month => (
<MenuItem key={month} value={month} autoFocus={true} style={{ fontSize: Theme.typography.caption.fontSize }}>
{month}
</MenuItem>
))}
</Select>
When clicking on the Material Ui select it scrolls to top of the page every time within iframe.
I have created on react application which has select option for month and year. when i click on the select button it auto scrolls to the top of the page which is very annoying
This issue is occurring when i am loading react app within iframe only.
without iframe it is working fine
<Select
variant="outlined"
IconComponent={KeyboardArrowDown}
labelId="demo-simple-select-label"
style={{ marginRight: "10px", fontSize: Theme.typography.caption.fontSize}}
placeholder={Content?.expiryMonthPlaceHolder}
id="expirationMonth"
value={expirationMonth}
label="MM"
className={classes.cardmonth}
// expirationMonth ? classes.cardmonth : classes.cardmonthEmpty
// }
onChange={e => {
setExpirationMonth(e.target.value);
}}
>
{months.map(month => (
<MenuItem key={month} value={month} autoFocus={true} style={{ fontSize: Theme.typography.caption.fontSize }}>
{month}
</MenuItem>
))}
</Select>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论