-
Notifications
You must be signed in to change notification settings - Fork 30
Disable app article swipe on interactive atom blocks #14131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Hello 👋! When you're ready to run Chromatic, please apply the You will need to reapply the label each time you want to run Chromatic. |
|
Size Change: +1.33 kB (+0.13%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
dotcom-rendering/src/components/InteractiveBlockComponent.importable.tsx
Outdated
Show resolved
Hide resolved
dotcom-rendering/src/components/InteractiveBlockComponent.importable.tsx
Outdated
Show resolved
Hide resolved
|
Chatted to @frederickobrien briefly about this PR, which is hugely promising — how might we test this? Fred mentioned there aren't many interactives that are likely to exercise this functionality because it does not currently work on Android. |
f56854e to
a44f936
Compare
|
Switching this to a draft, @jonathonherbert, because as per #14140 this might need a little more investigation than I initially thought |
|
"This PR is stale because it has been open 30 days with no activity. Unless a comment is added or the “stale” label removed, this will be closed in 3 days" |
a44f936 to
d5e8f89
Compare
…rtable.tsx Co-authored-by: Jonathon Herbert <[email protected]>
…rtable.tsx Co-authored-by: Jonathon Herbert <[email protected]>
d5e8f89 to
2e7fcf5
Compare
|
"This PR is stale because it has been open 30 days with no activity. Unless a comment is added or the “stale” label removed, this will be closed in 3 days" |
|
This PR was closed because it has been stalled for 3 days with no activity. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me - only limited to interactive Articles. Approved.
| const onTouchStart = () => getInteractionClient().disableArticleSwipe(true); | ||
|
|
||
| const onTouchEnd = () => getInteractionClient().disableArticleSwipe(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small performance suggestion.
I think these functions will be created on every render of this component even though they may not be used by the web rendering target. We could inline them in but again they will be created on every render of the component. useCallback is an option but given the functions are idempotent and afaics don't rely on any state could they be moved outside of the component to the module level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @frederickobrien , couple of questions about the atom implementation.
| onTouchStart={isApps ? onTouchStart : undefined} | ||
| onTouchEnd={isApps ? onTouchEnd : undefined} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appear to be wrapped in an Island, so what allows this code to run on the client?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description above says (emphasis mine):
As per #14140 the changes here currently apply to interactive elements but not atoms.
But this is the component for interactive atoms?
(It's deprecated)
Can of worms formally opened.
For recurring pieces, it’s often the same embed offender (old mobile templates degrade it to showing images stacked vertically as a workaround): Here is an ongoing series where it’s still used: https://www.theguardian.com/lifeandstyle/series/flashback
Another alternative would be to switch article swipe to two-finger swipe… |
In the same spirit as #14127 this fires the Bridget function
disableArticleSwipe()when readers are interacting with interactive embed blocks. The implementation here is more targeted than on interactive articles, more akin to carousels and key events in live blogs.This will allow interactive embeds to have a wider range of features. At present a lot of touch events don't work as intended because they clash with Android's 'swipe for next article' feature.
Would really value @guardian/dotcom-platform's take on this as we don't want to overstep. As per #14140 the changes here currently apply to interactive elements but not atoms. The PR will will need further work to cover the use cases we want it to.
Alternatively, we could deprecate the swipe for next article feature entirely...