javascript-tutorial / javascript-tutorial/en.javascript.info

Text selection is reset after pressing a button in iOS/iPadOS

未关闭
#3,087 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
HTML
星标
25.5k
派生
4k
PR 合并指标
30 天内没有已合并 PR

描述

Problem
The Selection and Range article includes a demo button that should show an alert with the selected text. On desktop environments or non-Apple mobile devices, the demo works correctly. The alert shows the current selected text, while the selection itself is also maintained.

However on iOS/iPadOS devices(iPhone, iPad, ...) the text selection disappears as soon as you press the button and the alert appears with empty text.

I believe this is an issue with iOS/iPadOS Safari, rather than a bug in javascript.info but nevertheless I wonder if anyone could share some insight on why this isn't working as expected. I've tried my best but up to this point could not find any similar troubleshooting anywhere else.

https://user-images.githubusercontent.com/34783801/176479597-5d7d5621-a513-497a-a114-3cd4b2c055f8.MP4

.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Selection and Range 文章及其演示按钮开始,然后使用提供的示例在 iOS/iPadOS Safari 上复现该行为。将选中的文本和 alert 行为与桌面环境及非 Apple 移动环境进行比较;完成的标准是确定这是 Safari 的限制还是 demo 中的问题,并记录证据或受支持的 workaround。

由索引模型根据 Issue 内容生成。

评估

技术栈
html, javascript
领域
documentation
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。