discourse/app/assets/stylesheets/common/base
Jeff Wong d208396c5c
UX: improve touch, swipe, panning performance on mobile menus (#23775)
PERF: improve touch, swipe, panning performance on mobile menus
---

* stop event propagation on swipe events: other touch events were stealing a huge amount of time here. Stop event
propagation when handling pan events.
* animate with [web animations api](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API/Using_the_Web_Animations_API)
* prefer translate3d to hint for gpu rendering.
* query document for elements only on start move event, not on subsequent move
events
* remove unused calculations for directioned velocity and distance: all swipe/pan elements function in x/y direction only.
* re-implement scroll locking behavior.

re-implemented scroll lock behavior
---

With stop event propagation, we need to re-implement scroll locking on menu swipes.
Previously, this was using onTouchMove which was costly.

We may now use styling with overflow-y:hidden to lock scroll behavior.

overflow:hidden on html/body elements is now supported by iOS as of 2022
https://bugs.webkit.org/show_bug.cgi?id=153852
https://bugs.webkit.org/show_bug.cgi?id=220908

UX: improve swipe
---

Some improvements to get gestures and swipes feeling a little more polished.

This focuses on end gesture, and how we transfer it to a css animation to
complete a menu open/close action.

Multitouch: events may pan, scroll, and zoom - especially on iOS safari.
Cancelling the swipe event allows for a more pleasant zooming experience.

* ease-out on menus opening, linear on close
* calculate animation duration for opening and closing,
attempt to better transfer user swipe velocity to css animation.
* more timely close/open and cleanup from calculated animation timing.
* add animation to closing menus on cloak tap
* correctly animate menus with ease-in and ease-out
* add swipe cancel event on multitouch event

DEV
---

* lean on promises

js animations api gives us promises to listen to. Update test waiters
to use waitForPromise from @ember/test-waiters instead of reigster/unregister.

* convert swipe mixin to its own class.

Convert swipe callbacks to custom events on the element.
Move shared functions for max animation time and close logic to
new shared class.

swipe-events lib uses custom events to trigger callbacks, rather than assuming
implemented hard coded function from the mixin's base class. Custom events are
triggered from the bound element as swipestart, swipeend, swipe

Add shared convenience functions for swipe events so they can be more easily
shared.

A client receives an initial swipe event and can check some state to see if it
wants to handle the swipe event and if it doesn't, calling
`event.preventDefault();` will prevent `swipe` and `swipeend` events from firing
until another distinct swipestart event is fired. Swipe events will auto-cancel on multitouch.

The scroll lock has also exposed as its own utility class.
2023-10-16 11:27:00 -07:00
..
_index.scss FEATURE: Add Revise... option for queued post reviewable (#23454) 2023-10-13 11:28:31 +10:00
_topic-list.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
about.scss A11Y: improve summary page user link structure (#23746) 2023-10-03 09:43:45 -04:00
activation.scss DEV: Use more css vars (#18561) 2022-10-12 16:05:42 +02:00
alert.scss UX: highlight vars updates (#20346) 2023-02-21 10:15:49 +01:00
bbcode.scss
cat_reorder.scss UX: Increase width & center category reorder input (#10928) 2020-10-15 14:42:42 +11:00
category-list.scss FIX: add category colors back to categories pages (#21977) 2023-06-07 12:57:10 -04:00
code_highlighting.scss UX: update hljs-builtin-name highlight (#16859) 2022-05-18 15:55:40 +02:00
colorpicker.scss FEATURE: Use native color-picker (#15748) 2022-02-01 11:18:13 -03:00
compose.scss UX: fix tag chooser width when there are multiple tags (#23432) 2023-09-06 16:01:03 +05:30
composer-user-selector.scss DEV: Use css var font sizes (#18518) 2022-10-12 15:31:59 +02:00
crawler_layout.scss UX: Style edits (#19927) 2023-02-15 11:02:16 -06:00
d-icon.scss FEATURE: automatic dark mode (#10341) 2020-08-03 22:57:10 -04:00
d-image-grid.scss UX: Better alignment for experimental grids (#22066) 2023-06-13 09:25:46 -04:00
dialog.scss A11Y: disable non-essential CSS animations for reduced-motion users (#23571) 2023-09-14 17:31:43 -04:00
directory.scss A11Y: improve summary page user link structure (#23746) 2023-10-03 09:43:45 -04:00
discourse.scss UX: improve touch, swipe, panning performance on mobile menus (#23775) 2023-10-16 11:27:00 -07:00
edit-category.scss DEV: Apply form template to categories (#20337) 2023-02-23 11:18:14 -08:00
edit-topic-timer-modal.scss DEV: Convert edit-topic-timer modal to component-based API (#23252) 2023-08-25 12:17:34 -05:00
ember-select.scss FEATURE: automatic dark mode (#10341) 2020-08-03 22:57:10 -04:00
emoji.scss UX: improve emoji alignment for text (#19815) 2023-01-30 14:07:08 +01:00
empty-state.scss DEV: Use css var font sizes (#18518) 2022-10-12 15:31:59 +02:00
exception.scss DEV: Use css var font sizes (#18518) 2022-10-12 15:31:59 +02:00
explain-reviewable.scss DEV: Prettify negative numbers in reviewable score explanation (#23642) 2023-09-25 10:34:51 +01:00
faqs.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
group.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
groups.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
header.scss A11Y: disable non-essential CSS animations for reduced-motion users (#23571) 2023-09-14 17:31:43 -04:00
history.scss DEV: fix history modal code, consolidate style (#23743) 2023-10-03 09:42:09 -04:00
lightbox.scss UX: remove rounded border on hover lightbox (#22080) 2023-06-13 13:31:28 +02:00
login.scss A11Y: move new account disclaimer above buttons (#23884) 2023-10-12 11:30:03 -04:00
magnific-popup.scss UX: force long filenames to wrap in lightbox (#22091) 2023-06-13 13:34:14 -04:00
menu-panel.scss UX: improve touch, swipe, panning performance on mobile menus (#23775) 2023-10-16 11:27:00 -07:00
modal.scss DEV: Add UI for passkeys (3/3) (#23853) 2023-10-13 12:24:06 -04:00
new-user.scss DEV: Refactor GroupNotificationsButton into userPrivateMessages.group route (#21930) 2023-06-07 06:22:50 +08:00
not-found.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
onebox.scss DEV: Prevent videos from preloading metadata (#23807) 2023-10-12 13:47:48 -06:00
personal-message.scss A11Y: disable non-essential CSS animations for reduced-motion users (#23571) 2023-09-14 17:31:43 -04:00
popup-menu.scss REFACTOR: move shadow vars to css custom props (#22094) 2023-06-13 16:38:31 -04:00
redirection.scss DEV: Use more css vars (#18561) 2022-10-12 16:05:42 +02:00
request_access.scss DEV: Use css var font sizes (#18518) 2022-10-12 15:31:59 +02:00
request-group-membership-form.scss DEV: Convert request-group-membership-form to new modal api (#23600) 2023-09-15 00:39:52 +02:00
reviewables.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
revise-and-reject-post-reviewable.scss FEATURE: Add Revise... option for queued post reviewable (#23454) 2023-10-13 11:28:31 +10:00
rtl.scss FEATURE: Serve RTL versions of admin and plugins CSS bundles for RTL locales (#21876) 2023-06-01 05:27:11 +03:00
search-menu.scss DEV: Restructure search menu so that it can be rendered outside of header (#23852) 2023-10-10 11:36:32 -05:00
search.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
share_link.scss UX: Move post date under title in share-modal (#16455) 2022-04-27 16:36:08 +03:00
shared-drafts.scss FEATURE: automatic dark mode (#10341) 2020-08-03 22:57:10 -04:00
sidebar-custom-section.scss UX: visual indicator for reorder sidebar links mode (#22379) 2023-07-04 09:56:52 +10:00
sidebar-footer.scss FIX: restore sidebar footer background (#21956) 2023-06-06 14:46:08 -04:00
sidebar-more-section-links.scss UX: fix "More" menu at small tablet width (#23616) 2023-09-15 17:21:24 -04:00
sidebar-section-link.scss UX: Remove section heading for community section (#22405) 2023-07-11 09:40:37 +08:00
sidebar-section.scss DEV: FloatKit (#23650) 2023-09-26 13:39:52 +02:00
sidebar.scss DEV: FloatKit (#23650) 2023-09-26 13:39:52 +02:00
static-login.scss REFACTOR: move shadow vars to css custom props (#22094) 2023-06-13 16:38:31 -04:00
tagging.scss UX: creates a vertical space between the title and the back link (#23558) 2023-09-15 12:16:23 +10:00
tooltip.scss REFACTOR: move shadow vars to css custom props (#22094) 2023-06-13 16:38:31 -04:00
topic-admin-menu.scss A11Y: disable non-essential CSS animations for reduced-motion users (#23571) 2023-09-14 17:31:43 -04:00
topic-post.scss DEV: FloatKit (#23650) 2023-09-26 13:39:52 +02:00
topic-summary.scss A11Y: disable non-essential CSS animations for reduced-motion users (#23571) 2023-09-14 17:31:43 -04:00
topic.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
upload.scss FEATURE: automatic dark mode (#10341) 2020-08-03 22:57:10 -04:00
user-badges.scss DEV: common CSS property for content backgrounds (#23467) 2023-09-08 12:07:04 -04:00
user-tips.scss DEV: FloatKit (#23650) 2023-09-26 13:39:52 +02:00
user.scss DEV: Add UI for passkeys (3/3) (#23853) 2023-10-13 12:24:06 -04:00