Repository navigation
feat(anchor,popup-menu): clamp cross-axis anchored_fit for submenus and add App::on_field_menu / Tx::resolve_field_menu fallback - #2025
Merged
Conversation
…nd add App::on_field_menu / Tx::resolve_field_menu fallback
Hona
force-pushed
the
feat/529-submenu-fit-field-menu
branch
from
November 24, 2026 21:19
fdd8738 to
62aa812
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #529
Summary
El::anchored_fitclamping and side-placed submenu fitting (crates/rune/src/runtime/anchor.rs,crates/rune/src/el/anchor.rs,crates/rune-kit/src/overlays/popover.rs):fit_anchorednow bounds overflowingEl::anchored_fitsurfaces on both the main axis (fit_bound) and the cross axis (cross_fit_bound,bounds_span - 2 * MARGIN), lowering definitemin_width/min_heightfloors when they exceed the available room so CSS/Taffy min-over-max precedence cannot push a floored surface past the window orEl::anchored_inboundary.rune_kit::popover::fitnow appliesEl::anchored_fitforSide::Left | Side::Rightas well asTop | Bottom, so overflowingrune_kit::Menusubmenus stay inside small windows (such as 420×400) and scroll vertically. Surfaces that already fit on either side and within viewport height are unchanged.sizemiddleware (viewport-boundedavailableWidthandavailableHeight) and Rune's documented window-containment contract.crates/rune/src/popup_menu/mod.rs,crates/rune/src/runtime/input/field_menu.rs,crates/rune/src/app.rs,crates/rune/src/app/config.rs,crates/rune/src/window/spec.rs,crates/rune/src/overlay/options.rs):FieldMenuRequest(field_key,field_path,point,menu,into_menu),App::on_field_menu(also onWindowSpecandConfiguredOverlay), andTx::resolve_field_menu(Option<&str>).!popup_menu_supported()(e.g. Linux) andon_field_menuis registered, right-clicking a text field or pressing Menu / Shift+F10 delivers the ready-builtPopupMenu(inspectable viaPopupMenu::entries()) to the hook instead of queuing a native popup;tx.resolve_field_menu(Some(id))restores field focus if needed and runs the matching action (Cut, Copy, Paste, Select All, spelling suggestions, Learn Spelling, spellcheck toggle/languages).on_field_menuare unchanged. Native Linuxxdg_popupwindows remain tracked in Real popups: a popup of the window's tree, shown in a native window of its own #1369.flowchart LR A[Right-click / Shift+F10 on text_input] --> B{popup_menu_supported()?} B -- yes --> C[Queue native PopupMenu] B -- no --> D{App::on_field_menu set?} D -- no --> C D -- yes --> E[Deliver FieldMenuRequest with PopupMenu] E --> F[App renders in-window Menu via PopupMenu::entries] F --> G[Tx::resolve_field_menu Some id / None] G --> H[field_menu_pick runs action on field]Examples & docs
examples/kit-gallery: addedrune-menu--submenu-small-window(8/20-row "Open With" submenu clamping and scrolling inside 420×400) andrune-menu--field-menu-fallback(wired toApp::on_field_menuandTx::resolve_field_menu).El::anchored_fit,popover::anchored,FieldMenuRequest,App::on_field_menu,WindowSpec::on_field_menu,ConfiguredOverlay::on_field_menu, andTx::resolve_field_menu, pluscrates/rune/README.md,crates/rune-kit/README.md, andchangelog/unreleased/2026-11-25-submenu-fit-and-field-menu-fallback.md.