Repository navigation
fix: position codeblock copy buttons relative to their codeblock - #111
Merged
LineIndent merged 1 commit intoOct 21, 2026
Merged
LineIndent merged 1 commit into
LineIndent merged 1 commit into
Conversation
Fixes copy buttons in chart_util_wrapper and file_codeblock being absolutely positioned without a positioned ancestor, which caused them to anchor to the page root instead of the codeblock. Matches the pattern already used in demo_wrapper. Closes AI-342.
elviskahoro
pushed a commit
that referenced
this pull request
Oct 25, 2026
**Detail bug report:** [View on Detail](https://app.detail.dev/org_d38a878f-9df9-4c4b-a96a-f5180b860085/bugs/bug_1b3baf3e-451f-46f0-aeb4-d714f753d804) Closes #96 ## Bug `input(type="checkbox"/"number"/"range")` handed `on_change` a raw DOM **string** (`e.target.value`) instead of the upstream-typed payload — a **bool** (`e.target.checked`) for checkboxes and a coerced **number** (`Number(e.target.value)`) for number/range. Root cause: `InputComponent` subclasses upstream `Input` and delegates via `super().create(...)`. Upstream `Input.create` only performs its typed dispatch to `CheckboxInput`/`ValueNumberInput` under an `if cls is Input` exact-class guard, so dispatch silently no-ops for the subclass — every typed input fell through to the plain `input_event` (string) payload. Introduced when the wrapper became an `Input` subclass. ## Fix `components/ui/input.py` now replicates the upstream `type` dispatch to `CheckboxInput`/`ValueNumberInput` after applying buridan-ui's `data_slot`/`class_name` styling, then delegates to the typed component (matching the upstream contract that direct `BaseInput.create(type=...)` already exposed). The dispatch target classes are not `CoreComponent`s, so they don't strip buridan-ui's `unstyled` prop the way `InputComponent` does. Without care, `unstyled` would siphon into the rendered `css` style dict on the typed element. The wrapper therefore `pop`s `unstyled` before delegating, preserving the existing `unstyled` contract (and the `render_` early-return path of `set_class_name`) for typed inputs. A `cast(BaseInput, ...)` reconciles the sibling-class return with the inherited `Input.create` signature so pyright stays clean. ## Testing - New unit tests in `tests/test_input.py` cover: typed inputs return `CheckboxInput`/`ValueNumberInput` with `BooleanCastedVar`/`NumberCastedVar` `on_change` args; text/email/password/file and the default-type path stay `InputComponent` with `StringCastedVar` (no over-dispatch); the dispatch still forwards `data_slot` and the default `class_name`; `unstyled` is not forwarded to the typed component (exercising the `render_` early-return path via a `set_class_name` no-op monkeypatch) and does not leak onto the rendered DOM; and the wrapper's classes/arg types match upstream `BaseInput.create(type=...)` exactly. - End-to-end: stood up a minimal Reflex app importing the repo's `components.ui.input`, ran the dev server, and inspected the live-served compiled bundle. The shipped `onChange` handlers bind `Number(_e?.["target"]?.["value"])` for number/range and `_e?.["target"]?.["checked"]` for checkbox; the `unstyled` checkbox renders only `{className, data-slot, id, onChange, ref, type}` with no `unstyled` prop or `css`/`style` leak. - Routine checks: unit tests, full repo suite, pyright, and ruff format/lint all pass; regenerated `assets/docs/components/input.md` to keep the install snippet in sync with the source (required by the asset-sync gate). --- _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: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.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.
The copy buttons in
chart_util_wrapperandfile_codeblockare absolutely positioned, but their ancestors had noposition: relative, so the buttons anchored to the page root instead of staying pinned to the codeblock.Adds
relativeto the wrapper class names, matching the pattern already used indemo_wrapper.