Skip to content

[Bug Report] Field组件readonly状态下文字不能选中复制 #13898

Open

Description

@wiexin

重现链接

/

Vant 版本

4.9.22

描述一下你遇到的问题。

Field组件readonly状态下,onFocus 函数中直接触发了blur事件 导致文字不能选中复制
const onFocus = (event: Event) => {
state.focused = true;
emit('focus', event);

  // readonly not work in legacy mobile safari
  const readonly = getProp('readonly');
  if (readonly) {
    blur();
  }
};

重现步骤

1、Field组件 readonly

设备/浏览器

No response

Activity

  1. pangxie231 commented on Sep 19, 2026

    @pangxie231

    这里是否可以用inputMode="none"阻止软键盘弹出来替代这里的blur。从IOS 13开始这个属性就生效了。然后我看了也是有inputmode属性的传入的。
    解决方案
    去掉这里的blur;如果传入了readonly,inputmode的值如果传入就用传入的,没传入就设置为'none'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions