fix/year backspace clearing - #2100
Merged
huntabyte merged 4 commits intoAug 19, 2026
Merged
Conversation
unaffected by year backspacing.
🦋 Changeset detectedLatest commit: 9d0323b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
shireenmne
marked this pull request as ready for review
August 11, 2026 13:14
- Preserve year-segment focus after backspace correction - Add browser coverage for first-digit correction
Merged
dadezzz
pushed a commit
to dadezzz/events-cash-register
that referenced
this pull request
Aug 24, 2026
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [bits-ui](https://github.com/huntabyte/bits-ui) | [`2.18.2` → `2.19.0`](https://renovatebot.com/diffs/npm/bits-ui/2.18.2/2.19.0) |  |  | --- ### Release Notes <details> <summary>huntabyte/bits-ui (bits-ui)</summary> ### [`v2.19.0`](https://github.com/huntabyte/bits-ui/releases/tag/bits-ui%402.19.0) [Compare Source](https://github.com/huntabyte/bits-ui/compare/bits-ui@2.18.2...bits-ui@2.19.0) ##### Minor Changes - feat(Checkbox): pass `form` to the hidden input ([#​2089](huntabyte/bits-ui#2089)) ##### Patch Changes - fix(DateField): keep focus on the year while correcting its first digit ([#​2100](huntabyte/bits-ui#2100)) - fix(Tooltip): close `Tooltip.Trigger` on `pointerdown` for any pointer button so right/middle click dismiss the tooltip and cancel a pending delayed open ([#​2101](huntabyte/bits-ui#2101)) - fix(RadioGroup): don't select item on pointer-driven focus- [#​2098](huntabyte/bits-ui#2098) ([#​2098](huntabyte/bits-ui#2098)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4zMS4wIiwidXBkYXRlZEluVmVyIjoiNDQuMzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
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.
Overview
Fixes the DatePicker year-segment backspace behavior described in #2038.
This builds on the work started in #2046 by @joe-herbert, which correctly identified and fixed two of the three underlying issues:
Both of those fixes are preserved here.
What changed from #2046
The zero-padding approach used in
#handleYearBackspaceused integer division (Math.floor(parseInt(prev) / 10)) and re-padded the result back to 4 digits. In practice this reintroduced a leading zero mid-edit that shouldn't appear until the field is blurred, e.g.:"1980"→ backspace →"0198"(expected"198")The fix here replaces that with plain string slicing. Padding back to 4 digits on blur is handled separately by the existing
onfocusoutlogic, which was untouched and already correct. This also brings the year segment's backspace behavior in line with how day/month already worked.A small follow-on fix was also needed in
#handleYearNumberKey: after backspacing partway through the year, retyping the missing digits wasn't triggering the auto-advance to the next segment, because the advance check only counted raw keystrokes since the last backspace rather than the resulting string length. Fixed by also checkingstr.length === 4.CI
One check (
Test / Test - Chromium) has intermittently failed in this PR's history onshould close on outside clickinselectandcombobox, and separately on acontext-menutest, all via the same shared assertion helper (expectNotExistsinsrc/tests/browser-utils.ts:82), all unrelated todate-field.svelte.ts. The date-field suite itself has passed cleanly on every run, including after this PR's changes. This looks like pre-existing flakiness in that shared helper, happy to open a separate issue with the failure pattern if useful, but wanted to flag it here rather than have it look connected to this change.Credit
Thanks @Fardeen0-0 for flagging this issue and picking up where #2046 left off in identifying the CI failures