Repository navigation
fix: preserve custom styling on context menu shortcuts - #115
Merged
LineIndent merged 1 commit intoOct 21, 2026
Merged
Conversation
elviskahoro
added a commit
that referenced
this pull request
Nov 10, 2026
#115) **Detail bug report:** [View on Detail](https://app.detail.dev/org_d38a878f-9df9-4c4b-a96a-f5180b860085/bugs/bug_5ad87135-0dfa-469c-9e9c-bc9731cbd28b) Closes #100 ## Bug `card_twenty_two` ("Financial Ledger") and `card_twenty_six` ("Medication Record") build their tables from the low-level `table.root` primitives and passed `striped=True` to opt into zebra striping. But `striped` is only a declared parameter of the high-level `table(...)` builder — `TableRoot.create` captures it in `**props` and forwards it to `Div.create`, where Reflex stores it on the component's `style` dict. It renders as an Emotion `css:({ ["striped"] : true })` rule that browsers silently discard (the `striped` CSS property is unknown), so the cards shipped with no visible striping and a dead `striped=True` argument. ## Fix Since these cards build rows manually (with per-cell styling the high-level builder can't reproduce), the idiomatic fix is to apply the striping utility directly to each body row and remove the inert kwarg: - Added `class_name="even:bg-secondary/30"` to each body `table.row(...)` in both cards — the same utility `HighLevelTable.create` emits for striped tables. - Removed the inert `striped=True` from both `table.root(...)` calls. The `even:` variant is a `:nth-child(even)` selector, so attaching it to every body row produces the same visual alternation as the high-level builder (rows 2, 4, … shaded). ## Testing - **Unit tests (versioned):** 4 tests in `tests/test_table_striping.py` guard the invariants going forward — a render-level assert on `card_twenty_two()` pins zebra striping on the fixed card, the high-level `table(...)` builder honors `striped=True` and consumes it (never leaking it), defaults to no striping, and a tripwire confirming `table.root(...)` does **not** handle `striped` (so a future change to that API is deliberate, not silent). - **Routine checks:** full suite, pyright, and ruff all pass. - **Browser verification:** rendered a standalone page with the project's compiled Tailwind CSS and the actual row class names from the fix. Striped rows 2 and 4 render `oklch(0.97 0 0 / 0.3)` backgrounds (the `color-mix(in oklab, var(--secondary) 30%, transparent)` rule), rows 1 and 3 stay transparent, no `striped` CSS property appears anywhere in the DOM, and a control table without the striping class has uniform backgrounds. - **Live app:** the Reflex `/components` page could not be verified end-to-end due to a pre-existing React hydration error that prevents all masonry card content from rendering. Confirmed unrelated — the server-rendered HTML is byte-identical with and without this change. --- _Automatic Fixes PRs can be [configured here](https://app.detail.dev/org_d38a878f-9df9-4c4b-a96a-f5180b860085/settings/repos/repo_04b9d58c-daa0-46b6-9560-7f39569ec6eb/bugs)._ --------- Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com> Co-authored-by: elvis kahoro <github@elvis.ai>
elviskahoro
added a commit
that referenced
this pull request
Nov 10, 2026
…bare indicators (#265) ## Summary Scoped to `components/ui/context_menu.py` and its tests. Works through three `detail-app` bug reports in order, closing the two that still applied: - Closes #83 — `ContextMenuItem`/`GroupLabel`/`RadioItem`/`CheckboxItem`/`SubmenuTrigger` gated the `inset`/`variant` → `data-*` rewrite with `if props.get("inset"):` / `if props.get("variant"):`. That's a truthiness check, and Reflex's `Var.__bool__` raises `VarTypeError` unconditionally, so passing a state `Var` for either prop crashed app-definition time. Switched to presence checks (`"inset" in props`, `"variant" in props`) so both literal values and bound `Var`s work, matching the pattern already used in `tabs.py`. - Closes #221 — `ContextMenuRadioItemIndicator` / `ContextMenuCheckboxItemIndicator` rendered an empty span when called bare (no children), unlike every sibling indicator wrapper in the repo (`menu.py`, `select.py`, `checkbox.py`), which inject a default tick. Checked radio/checkbox items following the documented bare-indicator composition showed no visible checkmark. Now injects `hi("Tick02Icon")` when no children are supplied, while still preserving any explicitly-passed custom icon. - **Duplicate/already resolved: #37** — `ContextMenuShortcut` overwriting `class_name` instead of merging it (and ignoring `unstyled`) was already fixed by `cae6190` ("Preserve custom styling on context menu shortcuts (#115)"), which also added regression tests (`test_context_menu_shortcut_*`) currently in `tests/test_context_menu.py`. No code change needed for #37; verified the existing tests still pass. ## Test plan - [x] Added regression tests in `tests/test_context_menu.py`: - `inset`/`variant` accept a `rx.State` `Var` without raising, for all five affected components, and still accept plain literals (#83) - Bare `radio_item_indicator()` / `checkbox_item_indicator()` render a default tick icon, and a custom icon passed as a child is preserved, not duplicated (#221) - [x] `uv run pytest tests/` — 1277 passed, 4 skipped (full suite, no regressions) - [x] `uv run ruff check components/ui/context_menu.py` — clean - [x] `trunk check components/ui/context_menu.py tests/test_context_menu.py` — no new issues (pre-existing `semgrep`-ignored notices only) - [x] Regenerated `assets/docs/components/context-menu.md` via `scripts/generate_markdown.py` so the doc's embedded source snippet stays in sync (caught by `tests/test_generated_assets.py`) No lint config changes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- conductor-workspace-link --> --- [Open workspace in Conductor](https://app.conductor.build/elviskahoro-cloud/w/701) --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.
ContextMenuShortcut.createunconditionally overwroteprops["class_name"], so a caller-providedclass_namewas silently dropped and never reached the rendered component.Uses
cls.set_class_name(...)instead so custom classes merge with the defaults, consistent with the other menu components. Addstests/test_context_menu.pycovering the default, merged, and unstyled cases.