HomePhabricator
Diffusion Comm 14853b1cafe1

[native] Block link press if spoiler is not yet revealed

Tags
None
Referenced Files
F276242: LinkSpoilers (New).mov
Dec 15 2022, 12:15 PM
File Not Attached
F276237: LinkSpoilers (Before).mov
Dec 15 2022, 12:15 PM
File Not Attached
Subscribers
None

Description

[native] Block link press if spoiler is not yet revealed

Summary:
If we have a link contained within a spoiler, we want to prevent the link from being visible/clickable until the spoiler is revealed. Here, we introduce MarkdownSpoilerContext since we need to keep track, on a per-spoiler basis, if there is a link within a spoiler. If there is a spoiler link, and it is not yet revealed, we do not want the onPress for MarkdownLink to fire.

The hierarchy in react-devtools for a MarkdownLink contained in a MarkdownSpoiler is:

MarkdownParagraph
  MarkdownSpoiler
    MarkdownLink

This is why I used Context, and text[0].props.target is only valid if a MarkdownLink is rendered below a MarkdownSpoiler, since MarkdownLink has a target prop.

Linear Task: https://linear.app/comm/issue/ENG-2233/make-spoiler-components-block-link-reveal-click-until-the-spoiler-is

Test Plan:
Android/iOS video below

Before:

After:

Reviewers: tomek, ginsu, ashoat

Reviewed By: tomek, ashoat

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D5835

Details

Provenance
rohanAuthored on Dec 6 2022, 1:11 PM
Reviewer
tomek
Differential Revision
D5835: [native] Block link press if spoiler is not yet revealed
Parents
rCOMM2dfff91655d0: [lib] introduced shimUnsupportedMessageInfo function to reaction message spec
Branches
Unknown
Tags
Unknown