You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sometimes the built-in defaults are not enough for the desired behavior and adding custom middlewares is needed. currently there's no way to inject additional middlewares that would augment the default behavior
as well as adding them in the middleware array here
↩️ Alternatives
alternatively, it could accept middlewares: Middleware[] that would replace any "default" positioning middlewares (well, except those used internally) and make it ignore params like flip/slide/..., though imo it's less clean
while technically achievable right now via updatePosition, it's a everything-or-nothing kind of api, where you either just run the passed default implementation and hack around it, or implement all positioning yourself. and neither is ideal.
📝 Additional Information
my specific use-case is a slightly modified version of the shift middleware that gives up shifting entirely beyond a certain position (so that the later middlewares can handle positioning instead, e.g. flip).
this is currently not possible with zag because:
shift middleware runs afterflip
the default shift middleware doesn't let me pass a custom limiter
i can't pass custom pre/post middlewares to work around the above limitations
This discussion was converted from issue #2844 on November 14, 2025 20:16.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
🚀 Feature request
/subj
🧱 Problem Statement / Justification
sometimes the built-in defaults are not enough for the desired behavior and adding custom middlewares is needed. currently there's no way to inject additional middlewares that would augment the default behavior
✅ Proposed solution or API
adding these to
PositioningOptions:as well as adding them in the middleware array here
↩️ Alternatives
alternatively, it could accept
middlewares: Middleware[]that would replace any "default" positioning middlewares (well, except those used internally) and make it ignore params likeflip/slide/..., though imo it's less cleanwhile technically achievable right now via
updatePosition, it's a everything-or-nothing kind of api, where you either just run the passed default implementation and hack around it, or implement all positioning yourself. and neither is ideal.📝 Additional Information
my specific use-case is a slightly modified version of the
shiftmiddleware that gives up shifting entirely beyond a certain position (so that the later middlewares can handle positioning instead, e.g.flip).this is currently not possible with zag because:
shiftmiddleware runs afterflipshiftmiddleware doesn't let me pass a custom limiterBeta Was this translation helpful? Give feedback.
All reactions