Repository navigation
fix: preserve focus established before deferred autofocus - #2165
Merged
huntabyte merged 1 commit intoSep 22, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 5702ce6 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
|
huntabyte
approved these changes
Sep 22, 2026
Merged
dadezzz
pushed a commit
to dadezzz/events-cash-register
that referenced
this pull request
Sep 26, 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.19.2` → `2.19.3`](https://renovatebot.com/diffs/npm/bits-ui/2.19.2/2.19.3) |  |  | --- ### Release Notes <details> <summary>huntabyte/bits-ui (bits-ui)</summary> ### [`v2.19.3`](https://github.com/huntabyte/bits-ui/releases/tag/bits-ui%402.19.3) [Compare Source](https://github.com/huntabyte/bits-ui/compare/bits-ui@2.19.2...bits-ui@2.19.3) ##### Patch Changes - Prevent delayed focus-scope autofocus from overriding focus already established in the scope or a nested scope. ([#​2165](huntabyte/bits-ui#2165)) - fix(Dialog, AlertDialog): pass `preventOverflowTextSelection` to the text selection layer explicitly instead of letting it ride the rest props onto the rendered content element as a `preventoverflowtextselection` attribute. ([#​2154](huntabyte/bits-ui#2154)) - fix(Floating): ignore `autoUpdate` callbacks that fire after the floating element's effect is destroyed to avoid `derived_inert` ([#​2164](huntabyte/bits-ui#2164)) - Fix `user-select: none` being stranded on `<body>` after clicking inside `forceMount`ed content (Popover, Tooltip, Dialog, AlertDialog, Menu, Select), which left the whole page unselectable until a reload. ([#​2161](huntabyte/bits-ui#2161)) - refactor: the context-menu attribute names and the floating root/anchor state move to leaf modules, so `DismissibleLayer` no longer imports the menu module for two strings, and `FloatingLayer` / `FloatingLayer.Anchor` no longer import the floating content module (and `@floating-ui/dom`) to register a root and its trigger. No behaviour change. ([#​2158](huntabyte/bits-ui#2158)) - fix(Menu): the trigger's `aria-controls` links to the content when the menu starts open. The content registers its id by replacing a plain field on the menu state, which a trigger rendered before the content had already read as empty and never re-read; the registration is now reactive. ([#​2159](huntabyte/bits-ui#2159)) - fix(Combobox): open the trigger on a touch tap instead of on touch down, so a finger that lands on it while scrolling no longer opens the list. Takes the Select trigger's touch timing. ([#​2156](huntabyte/bits-ui#2156)) - perf: avoid O(n) work per rendered item on hot paths ([#​2110](huntabyte/bits-ui#2110)) - `Select`/`Combobox`: item props now derive from per-item booleans, so moving the highlight or changing the value only rebuilds props (and re-diffs attributes) for the items that actually changed instead of every mounted item - `Select`/`Combobox` (multiple): selection lookups use a set instead of scanning the value array once per item - `Calendar`/`RangeCalendar`: `data-today` resolves the local timezone once per calendar rather than once per cell - `Menu` family: the document-level `pointermove` listener is only attached while keyboard mode is active - `ScrollArea`, `Slider`, `NavigationMenu`: internal resize observation shares a single `ResizeObserver` across all observed elements - fix(TimeField): keep the day period when typing the hour and then editing another segment in 12-hour mode ([#​2148](huntabyte/bits-ui#2148)) - Fix `user-select: none` being left on `<body>` when something else on the page calls `preventDefault()` on a `pointerup`, which made the whole page unselectable. The text-selection layer's release is internal cleanup and no longer skipped when the event's default action has been cancelled. ([#​2163](huntabyte/bits-ui#2163)) - fix(Collapsible): invalidate deferred measurements when content is replaced or destroyed ([#​2149](huntabyte/bits-ui#2149)) - Fix outside clicks being lost while dismissible content such as DropdownMenu is opening. ([#​2143](huntabyte/bits-ui#2143)) </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:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMTUuMiIsInVwZGF0ZWRJblZlciI6IjQ0LjExNS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
This branch was successfully deployed
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.
Problem
FocusScope schedules open autofocus for the next animation frame, but the callback previously checked only whether its container still existed.
A parent menu can open, queue that callback, and then receive keyboard input that opens and focuses a submenu before the callback runs. The scope manager pauses the parent when the child registers, but the queued parent callback ignored that change. It moved focus back into the parent; the submenu's focus-outside handler then closed the submenu. An item that was visible and focused could disappear before selection.
The same delayed callback could also override focus already established elsewhere inside its own scope.
Fix
Before applying deferred autofocus, check that the container is still mounted, this scope is neither paused nor superseded by another active scope, and focus has not already been established inside it. Ordinary initial autofocus still runs when the scope owns focus and has no focused target. Submenu dismissal behavior is unchanged.