feat(web): pressable links in the input component - #795
Open
hejsztynx wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new useLinkPress hook uses event typings that don’t match the generic Event provided by handleDOMEvents, which can cause TypeScript friction and makes the handler contracts misleading.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds web-only link click handling to EnrichedTextInput via a new onLinkPress prop, while refactoring link press-color styling so both EnrichedText and EnrichedTextInput share the same CSS variable and “pressable” styling behavior.
Changes:
- Added
onLinkPresssupport forEnrichedTextInput(Web) using a dedicateduseLinkPresshook and conditional “pressable” classname wiring. - Refactored link press-color CSS variable generation to come from
HtmlStyle.a.pressColor, and updated defaults accordingly. - Updated example app + Playwright coverage to validate
onLinkPressbehavior (no-op when omitted; emits{ url }when enabled).
File summaries
| File | Description |
|---|---|
| src/web/styleConversion/htmlStyleToCSSVariables.ts | Adds --et-link-press-color mapping to link vars and removes older EnrichedText-only link press var expansion. |
| src/web/styleConversion/tests/htmlStyleToCSSVariables.test.ts | Updates unit tests to cover link press color var mapping and revised fallback expectations. |
| src/web/htmlExtensions/useLinkPress.ts | Introduces hook to intercept link clicks and manage pressed styling class in the editor. |
| src/web/EnrichedTextInput.tsx | Wires onLinkPress into ProseMirror/Tiptap DOM event handling and toggles link-pressable classname. |
| src/web/EnrichedText.tsx | Toggles link-pressable classname based on presence of onLinkPress. |
| src/web/EnrichedText.css | Makes link pressed styling conditional on .et-link-pressable and disables pointer cursor when not pressable (view). |
| src/web/constants/classNames.ts | Adds shared classnames for “pressable links” and “pressed link” state. |
| src/utils/defaultHtmlStyle.ts | Moves a.pressColor default to the base DEFAULT_HTML_STYLE to support both components. |
| src/types.ts | Adds HtmlStyle.a.pressColor (web-only), adds EnrichedTextInputProps.onLinkPress, and exports OnLinkPressEvent. |
| apps/example-web/src/testScreens/TestLinks.tsx | Adds UI toggle + payload display for onLinkPress in the test screen. |
| apps/example-web/src/defaultHtmlStyle.ts | Adds link pressColor to the example web defaults. |
| apps/example-web/src/App.tsx | Demonstrates onLinkPress in the example app by logging the event. |
| .playwright/tests/links.spec.ts | Adds e2e coverage for onLinkPress enabled/disabled behavior. |
Review details
- Files reviewed: 13/13 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #790
onLinkPressprop for theEnrichedTextInputcomponent on Web. If not provided, the behavior doesn't change.a.pressColorinhtmlStyle, code regarding the previouslyEnrichedText-onlya.pressColorhas been refactored.EnrichedTextwhenonLinkPresswas not provided, you could still 'click' the link -pressColorwas applied and cursor was changed topointer. Fixed.All e2e and jest web tests pass.
Test Plan
The onPressLink event is wired up in the example app, you can see its effect in the console logs.
Play around with it, see if the the link's colors are correctly changing when pressing. Then you can remove the
onLinkPressprop from both theEnrichedTextInputandEnrichedTextcomponent and see that the links will not react on clicks anymore.Screenshots / Videos
With
onLinkPressdefined:Screen.Recording.2026-09-10.at.15.32.27.mov
With
onLinkPressnot defined:Screen.Recording.2026-09-10.at.15.34.17.mov
Compatibility
Checklist