RRUI-019 · RapidRailsUI defect

Menu collision placement persists across reopen

A menu that flips to avoid a viewport edge can retain contradictory placement and spacing classes after it closes and reopens.

Openrapid_rails_ui v0.58.1reported 2026-10-05

Upstream triage requested. This was found while following the standard RapidRailsUI installation guide in a vanilla Rails 8 application using Importmap and Tailwind CSS v4.

At a glance

Component`menu_controller.js`
ObservedThe reset removes only `left-0` and `right-0`. Flipped `left-full`/`right-full`, `top-full`/`bottom-full`, edge, and margin classes remain, so a later open can combine the original and flipped placement.
ExpectedClosing and reopening should restore exactly the configured placement before collision detection runs again.
ImpactMenus can open offset from their trigger or on the wrong side after a prior collision.

Reproduction

1. Configure a menu with a right or left placement near the viewport edge.\n2. Open it so collision handling flips the placement.\n3. Close and reopen it.\n4. Inspect the class list and observe both original and flipped placement classes.

Suggested direction

Clear the complete placement class set, including edge and spacing utilities, before restoring the configured placement.

Consumer workaround

Remove all horizontal, vertical, edge, and spacing placement classes in `_resetMenuPosition()` before adding the configured placement map.