Skip to content

fix: align one-page form inputs and open the New choice menu under its button - #1806

Merged
chhoumann merged 3 commits into
masterfrom
fix/one-page-alignment-new-choice-menu
Sep 26, 2026
Merged

chhoumann merged 3 commits into
masterfrom
fix/one-page-alignment-new-choice-menu

Conversation

@chhoumann

@chhoumann chhoumann commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Fixes two layout bugs in QuickAdd's UI.

One-page form: inputs didn't line up. Text inputs keep their natural width. Textareas and sliders fill the control box, though, and that box's width came from the flex split with the label, so a shorter label pushed those controls left of everything else (in the screenshot, "Body" starts 122px left of "Title"). The form now gives every row the same control column (60% of the row), and inputs fill it, so every control starts at the same x whatever the label length. Dropdowns keep Obsidian's compact, right-aligned style. Rows that stack (dates, the <=540px layout, discovery forms) still override the column width. The file picker's own min(28rem, 62%) width is replaced by the shared column, and the range input's default 2px margin is zeroed so the slider track lines up too.

Before After
One-page form before One-page form after

"New choice" menu opened to the left of its button. The menu was anchored at the button's left edge only. The button sits at the right of the bar, so the 418px menu overflowed the window, and Obsidian flipped it to end at that anchor, which left it entirely left of the button. This happened at 1024px as well, not just in narrow windows (menu 352-770, button 772-908). Passing the button's width with overlap: true makes the flip right-align the menu under the button. The primary button also passes left: true so its menu always right-aligns. The per-folder "Add choice" link (left side of a folder row) keeps left-aligning when it fits.

Before After
Menu before Menu after

Measured in real Obsidian 1.13.7 at window widths 420/600/800/1024/1600. After the fix, the primary menu's right edge equals the button's right edge at every width. At 420px the menu fills the window from x=0, so it still sits under the button.

Regression coverage (Obsidian e2e): tests/e2e/one-page-alignment.test.ts checks that text, textarea, number, slider, and suggester controls with short and long labels all start at the same x. The new case in tests/e2e/choice-list-layout.test.ts checks that the New choice menu opens below its button and is right-aligned with it. Both fail on master (textarea at 421.7 vs 549; menu right edge 770 vs button 908) and pass with this change. The full e2e suite (208 tests), unit tests, and build-with-lint pass locally.

Boyscout: tests/e2e/file-type-label.test.ts (from #1805) failed on master in a fresh vault. It expected [[<folder>/photo.png]], but QuickAdd writes links with generateMarkdownLink, which follows the vault's link format. Under the default "shortest" format a unique attachment is [[photo.png]]. The spec now checks where each link resolves (through the metadata cache) instead of its literal text. It passes under both "shortest" and "absolute". This is a separate test-only commit.

No release or migration impact.

Note

Fix New choice menu placement in AddChoiceControls to align under its button

The menu-opening handler in AddChoiceControls.svelte now passes the trigger button width and enables overlap-aware positioning. Noncompact layouts request right alignment; compact layouts use the alternate alignment. The existing mouse-event fallback path is unchanged.

  • Behavioral Change: menu placement when opened from the choice button differs in compact layouts (alternate alignment instead of right).

Macroscope summarized 750d6d6.

Summary by CodeRabbit

  • Improvements

    • The New choice menu now aligns its right edge with its button and opens below it.
    • Input controls in one-page modals now have consistent alignment and width, including range sliders.
  • Tests

    • Added checks for choice-menu positioning and consistent input alignment.
    • Updated attachment-link checks to verify links resolve to the expected files.

Textareas and sliders filled the control box, whose width came from the
flex split with the label, so a shorter label pushed them left of the
text inputs. The form now gives every row the same control column.
The menu was anchored at the button's left edge only, so whenever it
overflowed the window Obsidian flipped it to end at that point, leaving
it entirely left of the button. Passing the button's width with overlap
keeps it under the button; the primary button right-aligns its menu.
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: cdd9d0b7-29c4-488f-bf65-a1eaf0563ebf

📥 Commits

Reviewing files that changed from the base of the PR and between 3ee01a2 and 750d6d6.

📒 Files selected for processing (5)
  • src/gui/choiceList/AddChoiceControls.svelte
  • src/styles.css
  • tests/e2e/choice-list-layout.test.ts
  • tests/e2e/file-type-label.test.ts
  • tests/e2e/one-page-alignment.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

One-page modal controls now use consistent sizing, and the new-choice menu uses trigger bounds for positioning. End-to-end tests cover control alignment, menu placement, and generated attachment links.

Changes

Interface alignment

Layer / File(s) Summary
One-page modal control sizing
src/styles.css, tests/e2e/one-page-alignment.test.ts
One-page modal controls use a 60% column, direct child inputs fill the column, and slider range inputs have zero margin. The end-to-end test checks alignment across five control types and two label lengths.
New-choice menu positioning
src/gui/choiceList/AddChoiceControls.svelte, tests/e2e/choice-list-layout.test.ts
The menu uses the trigger’s bounds and width for positioning. The end-to-end test checks that it appears below the button, aligns at the right edge, and extends left.

Attachment link check

Layer / File(s) Summary
Attachment link destination assertions
tests/e2e/file-type-label.test.ts
The test checks for two wiki-link lines and verifies through Obsidian’s metadata cache that their destinations are photo.png and scan.pdf in the attachment folder.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 750d6

No actionable issue is established before merge. The menu’s placement in the supported application remains unconfirmed.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: aligning one-page form inputs and positioning the New choice menu under its button.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the menu’s place,
Then lines up fields with measured grace.
Two links lead where the cache says they should,
I nibble a leaf and call it good.
The tests hop onward, neat and clear.

Comment @coderabbitai help to get the list of available commands.

Comment thread src/styles.css
The written link text follows the vault's link format, so a unique
attachment gets [[photo.png]] under the default shortest format and the
full-path expectation failed. The spec now resolves each link through
the metadata cache and checks it lands on the picked file.
@chhoumann
chhoumann marked this pull request as ready for review September 26, 2026 16:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T16:21:13.110092Z 750d6d6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chhoumann
chhoumann merged commit 431cbc2 into master Sep 26, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant