0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 00:54:21 +08:00
discourse/app/assets
Sérgio Saquetim 22bef348eb
DEV: Add a dResizeEdge modifier and adopt it in the docked composer (#42200)
Discourse carries several independently written resize implementations.
The docked composer had its own: pointer capture, arrow-key stepping,
and bound clamping, all inline. `dResizeEdge` extracts that interaction
into a ui-kit modifier following the WAI-ARIA window splitter pattern.

The modifier owns the interaction only. It reports the size it computed
and leaves storing and applying it to the caller, so one element can
drive a width held in a component or an offset written to a CSS custom
property. `axis` selects which coordinate and which arrow keys drive it,
and `side` is interpreted logically, so a right-to-left writing
direction does not send the edge away from the pointer dragging it. It
also sets `touch-action: none` on the element itself rather than relying
on each caller's stylesheet, since a touch drag is otherwise claimed by
the browser as a scroll and cancelled.

`DockedComposer` now invokes the modifier in place of its four pointer
and keyboard handlers, keeping its existing custom property names and
ARIA values, so the rendered behaviour is unchanged.

Covered by tests for pointer dragging, keyboard stepping and clamping on
both axes, growth direction under `side` and under a right-to-left
writing direction, and the pointer capture lifecycle. The composer's
existing keyboard resize tests pass unchanged against the modifier.
2026-07-31 12:57:25 -03:00
..
images FIX: Duplicate notifications when mentioned in chat (#39670) 2026-04-30 14:52:39 -03:00
stylesheets DEV: Add a dResizeEdge modifier and adopt it in the docked composer (#42200) 2026-07-31 12:57:25 -03:00