Enable click and long-press copying of user ID/internal link in user profile dialog#36
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09701e38ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @touchstart="onNamePressStart" | ||
| @touchend="onNamePressEnd" | ||
| @touchcancel="onNamePressEnd" | ||
| @mousedown="onNamePressStart" | ||
| @mouseup="onNamePressEnd" |
There was a problem hiding this comment.
Prevent emulated mouse events from overriding long-press copy
Binding both touch* and mouse* press handlers to the same element causes a touch interaction to be processed twice on mobile browsers that emit compatibility mouse events after touch (as documented by MDN). In a long-press flow, touchstart triggers the timer and copies the internal link, but the later emulated mousedown resets didLongPress, so the final click path copies the plain user ID and overwrites the clipboard result. This makes long-press copy unreliable on touch devices unless you suppress compatibility mouse events (e.g., preventDefault) or switch to pointer events.
Useful? React with 👍 / 👎.
Motivation
Description
copyTextfrom@services/utilsand addedcopyTextWithMessageto show success/error feedback usingshowMessage.LONG_PRESS_MS, a press timer, and adidLongPressflag to distinguish long-press from click, withonNamePressStartandonNamePressEndhandlers to manage timing.copyUserIDfor single-click copying andcopyUserInternalLinkfor long-press copying of the<user=ID>name</user>formatted link, and wired those to the username element via@click, touch, and mouse events.Testing
npm run buildand the build completed successfully.npm testand all automated tests passed.showMessageduring copy operations.Codex Task