Skip to content

feat(web): onLinkPress and onMentionPress functionality#678

Open
hejsztynx wants to merge 10 commits into
mainfrom
@ksienkiewicz/feat-web-enriched-text-press-actions
Open

feat(web): onLinkPress and onMentionPress functionality#678
hejsztynx wants to merge 10 commits into
mainfrom
@ksienkiewicz/feat-web-enriched-text-press-actions

Conversation

@hejsztynx

Copy link
Copy Markdown
Collaborator

Summary

Implemented the onLinkPress and onMentionPress callback functionality.

Test Plan

  • write a mention or a link using the input in the example app
  • press on it
  • a relevant callback should be visible in the logs

Compatibility

OS Implemented
iOS
Android
Web

Checklist

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

Copilot AI review requested due to automatic review settings July 6, 2026 11:21
@hejsztynx hejsztynx marked this pull request as draft July 6, 2026 11:21

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.

Pull request overview

Adds Web support for onLinkPress and onMentionPress in EnrichedText, including press-state styling via CSS variables and validating behavior through Playwright E2E coverage.

Changes:

  • Introduces a Web press-interaction hook to intercept clicks on links, mentions, and checkbox list inputs.
  • Extends HTML-style → CSS-variable conversion and mention CSS generation to support press-state colors (links + mentions).
  • Updates docs + example-web screen and adds Playwright tests for link/mention presses (including inside lists).

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/web/usePressInteractions.ts New click-interaction hook to emit onLinkPress / onMentionPress and manage checkbox click behavior.
src/web/styleConversion/htmlStyleToCSSVariables.ts Adds enriched-text press CSS variables (link + mention) and helper conversion API.
src/web/styleConversion/buildMentionRulesCSS.ts Adds mention press-state CSS rules and CSS var fallbacks to default mention style.
src/web/styleConversion/tests/htmlStyleToCSSVariables.test.ts Adds unit tests for enriched-text press CSS variables and fallback behavior.
src/web/styleConversion/tests/buildMentionRulesCSS.test.ts Updates/extends tests for mention CSS var fallbacks and press-state rules.
src/web/EnrichedText.tsx Wires new press callbacks into the web EnrichedText component using stable refs.
src/web/EnrichedText.css Adds link :active styling; adjusts checkbox list interactivity to allow presses.
docs/WEB.md Documents that web now supports onLinkPress / onMentionPress.
docs/TEXT_API_REFERENCE.md Updates platform support tables to include Web for press callbacks.
apps/example-web/src/testScreens/TestEnrichedText.tsx Displays last press events for verification and E2E assertions.
apps/example-web/src/App.tsx Adds demo handlers logging link/mention press events.
.playwright/tests/enrichedTextPress.spec.ts Adds E2E coverage for link/mention presses (incl. nested styling + list cases).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/web/usePressInteractions.ts
Comment thread src/web/usePressInteractions.ts
Comment thread src/web/usePressInteractions.ts
@hejsztynx hejsztynx marked this pull request as ready for review July 6, 2026 11:52
Comment on lines +30 to +35
onLinkPress={(event) => {
setLastLinkPress(event);
}}
onMentionPress={(event) => {
setLastMentionPress(event);
}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
onLinkPress={(event) => {
setLastLinkPress(event);
}}
onMentionPress={(event) => {
setLastMentionPress(event);
}}
onLinkPress={setLastLinkPress}
onMentionPress={setLastMentionPress}

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.

3 participants