Skip to content

feat(web): pressable links in the input component - #795

Open
hejsztynx wants to merge 3 commits into
mainfrom
@ksienkiewicz/feat-web-pressable-input-links
Open

feat(web): pressable links in the input component#795
hejsztynx wants to merge 3 commits into
mainfrom
@ksienkiewicz/feat-web-pressable-input-links

Conversation

@hejsztynx

@hejsztynx hejsztynx commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #790

  • implemented onLinkPress prop for the EnrichedTextInput component on Web. If not provided, the behavior doesn't change.
  • as now both components use a.pressColor in htmlStyle, code regarding the previously EnrichedText-only a.pressColor has been refactored.
  • also I've noticed that in EnrichedText when onLinkPress was not provided, you could still 'click' the link - pressColor was applied and cursor was changed to pointer. 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 onLinkPress prop from both the EnrichedTextInput and EnrichedText component and see that the links will not react on clicks anymore.

Screenshots / Videos

With onLinkPress defined:

Screen.Recording.2026-09-10.at.15.32.27.mov

With onLinkPress not defined:

Screen.Recording.2026-09-10.at.15.34.17.mov

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • E2E tests are passing
  • Required E2E tests have been added (if applicable)

Copilot AI lite review requested due to automatic review settings September 10, 2026 13:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 onLinkPress support for EnrichedTextInput (Web) using a dedicated useLinkPress hook 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 onLinkPress behavior (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.

Comment thread src/web/htmlExtensions/useLinkPress.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants