Implement support for selection events - #5570
Merged
Merged
Conversation
ealmloff
marked this pull request as ready for review
May 19, 2026 20:04
jkelleyrtp
approved these changes
May 19, 2026
SilentVoid13
pushed a commit
to SilentVoid13/dioxus
that referenced
this pull request
May 21, 2026
MentalGear
pushed a commit
to MentalGear/dioxus-components
that referenced
this pull request
Sep 14, 2026
Adds the Input OTP one-time-passcode entry control (row 64, docs/component-backlog.md): primitives/src/input_otp.rs (InputOtp/InputOtpGroup/InputOtpSlot/InputOtpSeparator) plus its themed wrapper at preview/src/components/input_otp/, registered in preview/src/components/mod.rs and the root component.json. Original composition, not a port. It builds on the *shape* of Checkbox's BubbleInput pattern (primitives/src/checkbox.rs) -- one real, accessible, form-participating <input> kept in sync with a styled visual overlay -- but not BubbleInput itself: Checkbox's visible control is a <button>, which is not a submittable element, so it needs a second hidden native input purely for form participation. Input OTP's real <input type="text"> is simultaneously the interactive control (keystrokes, paste, caret) and the form-submittable one, so no second hidden input is needed here. The new DOM-caret-to-Rust-signal bridge (use_caret_sync, local to input_otp.rs) reuses the eval-listener-then-stream-back *shape* of crate::use_form_reset_listener/use_dialog_close_sync (lib.rs), needed because dioxus-html's SelectionEvent/SelectionData carries no cross-platform-readable selection range. No APG pattern exists for "OTP input" (verified against APG's pattern index and shadcn/ui's own docs, which describe InputOTP as a styled plain <input>), so this follows WCAG's generic text-input requirements instead: the real, focusable, labelled <input> is the accessible source of truth; InputOtpSlot/InputOtpGroup/InputOtpSeparator render inside an aria-hidden presentational layer. Two references were read, never vendored, per docs/lifting-from-forks.md §1: upstream Dioxus PR DioxusLabs#255 (ealmloff, draft, 21 commits) -- re-checked this session and still draft/blocked (last activity 2026-05-19, still waiting on DioxusLabs/dioxus#5570 for select-event-handler integration); and dignifiedquire/rust-ui's input_otp.rs, shape/edge-case reference only. Nothing lifted, so no provenance header or ledger entry. Verification actually run this session: - cargo check --workspace: clean. - cargo fmt --check: clean. - cargo clippy --workspace --tests --examples -- -D warnings: adds no new warnings. The bare command still fails on the three pre-existing, unrelated issues noted in this session's task scope (menu_sub.rs doc lint, field.rs dead-code FieldOrientation::Responsive, main.rs function-pointer comparison in the #[component] macro); reproduced identically with -A flags for those three lints, which then passes clean across the whole workspace -- confirming this diff introduces nothing new. - scripts/check-preview-composition.sh, check-cfg-axis.sh, check-dx-class-prefix.sh, check-css-literals.sh: all OK (class-prefix script's only output is the pre-existing top_layer warning). - playwright/input_otp.spec.ts, real execution: `npx playwright test --project=chromium` against a local `dx run --web --release` build (chromium-1223, matching this sandbox's pinned Playwright/opt/pw-browsers revision) -- 5 passed, 0 failed (typing/value-mirroring smoke test, paste-fills-all-slots, Backspace/Delete/ArrowLeft/ArrowRight active-slot movement, disabled-blocks-input, one axe scan). Also updates docs/component-backlog.md's Input OTP row (marks it landed, records what was built/reused/verified) and docs/backlog.md's "Fresh-session order" item 6 (Input OTP landed; Command/Drawer/ Navigation Menu/Resizable remain next in that wave). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TnGrdUKiZR7huWJbaxtujf
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 select event currently expose no event data. This PR adds selection data from the associated input/textarea element if it is associated with one
This makes it possible to implement components like DioxusLabs/dioxus-components#255 in dioxus without eval