Repository navigation
Conversation
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Virtual Select positions the dropbox itself, so the bundled popover-plugin goes. The two CSS rules still needed (.pop-comp-wrapper, .pop-comp-disable-events) move to src/sass/partials/popover.scss; the arrow and content rules are dropped. Removed surface (none of it documented, all of it existed only because the plugin was bundled): - window.PopoverComponent and window.PopperComponent. - $ele.popComp, $ele.show(), $ele.hide(), $ele.updatePosition(). The documented open() and close() are untouched. - data-popover-* attributes on the host element overriding popover options. - data-top, data-left, data-from-top, data-from-left on the dropbox container. - The <i class="pop-comp-arrow"> element is never rendered, as today. Its CSS goes. virtual-select.min.js gzip budget lowered by 3500 bytes (23207 baseline, 19707 max).
destroy() cleared the hide timer, so a destroy during the hide transition cancelled the afterHide() that removes pop-comp-active and left it on the host for good. OutSystems UI hits this: changeProperty() closes synchronously and redraws (destroy + init on the same element) on a 0 ms timer. destroy() now removes the class itself; reset() already calls destroy(). This also fixes destroying an open dropdown, which left the class stale on master too. The reduced-motion test now restores its matchMedia stub, which had leaked into the following test (testIsolation is off and cy.visit does not reload).
updatePosition() took the untransformed origin as the rect minus the current translate. The rect is in viewport pixels and the translate in the element's own, so under a scaled ancestor the origin was off by translate * (1 - scale) and each reposition moved the dropbox further (32px, 38px, then 40px after seven calls in a scale(0.8) container with dropboxWrapper 'self'; popover-plugin stayed at 32px). The translate is now scaled by rect width / offsetWidth before it comes off; a gap under one pixel is offsetWidth's rounding and counts as no scale, so the unscaled path is unchanged.
…and axis scales - An empty, null or unknown position falls back to 'auto', as popover-plugin did for an empty one; computePlacement() used to throw on open and leave the dropbox stuck in its show state. - Scroll listeners go on every root from the host's shadow root up to the document, and the ancestor test walks up through shadow hosts: scroll events do not leave a shadow root and Node.contains() does not look into one. - updatePosition() takes the ancestor scale per axis (height for the y translate), so an ancestor scaled on one axis no longer makes the dropbox drift on each reposition.
…against scaled hosts - A silent close (another dropdown opened from script) now sets aria-expanded false; it still fires no events. - The document Escape handler ignores keydowns another widget already handled (defaultPrevented) and IME composition keys. - The placement is computed in viewport pixels and now written in the dropbox's own: x, y and the from-translate are divided by the ancestor scale per axis, so a dropbox under a scaled ancestor opens against the host's edge instead of popover-plugin's offset. virtual-select.min.js budget raised to 19,750 B gzip (user decision): measured 19,726, 3,481 B below the 23,207 baseline.
This was referenced Nov 24, 2026
PR Test Results — ✅ all checks passed
Tested commit: |
…ioner Brings in PR 1's two test fixes (ancestor-scroll measurement, matchMedia restore). This branch already carries equivalent changes to dropbox-lifecycle.cy.ts, so the conflict resolves to this branch's version and the tree is unchanged.
…ioner Brings in PR 1's tightened checks. The budget-loop conflict resolves to PR 1's gzipSizeOf() helper, keeping this branch's maxGzip <= baselineGzip assertion (the same line).
No per-axis scale can undo a translate under a rotation or skew, so the matrix-based origin compounded an error on every reposition (seven repositions moved a dropbox under rotate(90deg) from x 204 to -3660). show() already forces a read after writing the from-translate; it now checks that the box moved the way the per-axis scales predict, and if not, repositions measure with transform: none, as popover-plugin did. Everyone else keeps the one-read, one-write path. virtual-select.min.js budget raised to 19,850 B gzip (user decision): measured 19,808.
The open-time check compared how far the from-translate moved the box with what the per-axis scales predict, so a mirror went unnoticed whenever the dropbox opened with no translate on the mirrored axis; once the host moved sideways every reposition drifted (100 to 25,500 in seven). show() now walks the dropbox's ancestors once, through shadow hosts, and repositions measure with transform: none when any of them rotates, skews or mirrors it, from transform or the standalone rotate and scale properties. The shadow-host step is shared with onScroll(). virtual-select.min.js budget raised to 19,900 B gzip (user decision): measured 19,857.
A host slotted into a web component is rendered inside that component's shadow tree, which its parentNode chain never enters. The ancestor walk now prefers assignedSlot, so a mirrored or rotated wrapper in the shadow tree switches repositions to re-measuring, and a scroll box there is listened to and followed.
… as values open() during the close animation used to be ignored by the positioner, leaving the dropdown closed but announced as expanded. It now finishes the close first (afterClose included), then opens normally. An open interrupted by a close keeps firing no afterOpen, now pinned by tests for both the normal and the silent close. The re-measure check no longer treats rotate: 0deg or a z-only mirror as a rotation. isShown() was unused and isHiding() had one caller, so both are gone to keep the core bundle within its gzip budget.
isOpened() stays true until the close animation ends, so a second toggle click, Enter or an arrow key during it ran another close, which the hiding guard swallowed. They now check isStayingOpen() and reopen, the same way open() does. The mirrored-ancestor test waits for the scroll's reposition instead of a fixed time, and the no-afterOpen rule for an interrupted open is documented on hide() and reset(). The document Escape handler reads e.key only, which keeps the core bundle within its gzip budget.
From the positioner change on, the code has no popover-plugin engine, so record mode always refuses. The header and the refusal now say to re-record on master instead of 'this PR's code'.
…03 -> 2623) The size check asks for maxGzip to follow a file down when a change shrinks it; dropping popover-plugin's styles shrank virtual-select.min.css to 2623 B gzip.
…n() is ignored - onDocumentClick() takes the node actually clicked (composedPath()[0]). At the document, a click inside a shadow root targets the shadow host, which no .vscomp-wrapper contains, so every click in an instance rendered there (its search box, a multi-select option) closed it as if outside. - openDropbox() returns once a positioner-backed dropbox is opening or open: the positioner would not show it again, so a second open() sent a second beforeOpen with no afterOpen. Popup and keepAlwaysOpen keep every open. - Specs: open() twice and open() while open fire the open events once; real clicks in a shadow-root instance's search box and options keep it open, and an outside click still closes it. The four fail on the code before. - virtual-select.min.js budget 19900 -> 19916: the shadow-root fix costs 16 B gzip, the guard nothing measurable (user decision).
gnbm
added a commit
that referenced
this pull request
Nov 25, 2026
…s-3-tooltip Budgets: the core takes #504's shadow-root click fix, 16 B gzip (user decision), so 19873 -> 19889.
…s-2-positioner # Conflicts: # cypress/e2e/dropbox-positioning-baseline.cy.ts
This branch has not been 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.
Issue number: none
Part 2 of 3 stacked PRs, based on #503. Review after #503; GitHub retargets this one to
vs-major-2.0.xonce #503 merges and its branch is deleted. Replaces #500.What is the current behavior?
popover-pluginplaces and animates the dropbox. It ships insidevirtual-select.min.jsand sets thewindow.PopoverComponentandwindow.PopperComponentglobals.afterClosefires twice.beforeCloseand leavesaria-expanded="true".pop-comp-activeand the plugin's scroll listeners behind, and the nextopen()shows nothing.open()on a dropdown already opening or open sends a secondbeforeOpenwith noafterOpen.What is the new behavior?
src/utils/placement.js:computePlacement(), a pure port of the plugin's placement maths, with unit tests.src/dropbox-positioner.js: the show/hide state machine.pop-comp-ele,pop-comp-wrapper,pop-comp-active,pop-comp-disable-events,position-*), the same placement and the same timing.One
beforeCloseand oneafterCloseper close.Escape from outside the component is a real close. It ignores keys another widget already handled and IME composition keys.
A silent close resets the positioner and
aria-expanded.Interrupted transitions:
open()during the close animation finishes the close first (afterCloseincluded), then opens.close()during the open animation fires noafterOpen, and neither does an instance closed because another one opened.open()on a dropdown already opening or open is ignored (popup andkeepAlwaysOpeninstances keep their current behaviour, where every open reachesafterOpen).Fixed while porting:
positionfalls back toautoinstead of throwing.composedPath()[0]).scaleorrotate: 0degis not.destroy()during the close transition no longer leavespop-comp-activebehind.popover-pluginis removed; the two CSS rules still needed move tosrc/sass/partials/popover.scss.Bundle size (gzip -9, the build check's method):
virtual-select.min.jsvirtual-select.min.cssBoth files sit exactly at their budgets, so the next byte either gains needs a budget decision. The shadow-root click fix took the JS from 19,900 to 19,916.
Does this introduce a breaking change?
The documented API (
open(),close(), events, options) is unchanged. Removed, none of it documented:window.PopoverComponentandwindow.PopperComponentglobals;$ele.popComp,$ele.show(),$ele.hide()and$ele.updatePosition(). Use$ele.open()and$ele.close();data-popover-*attributes on the host overriding popover options;data-top,data-left,data-from-topanddata-from-lefton the dropbox container.Behaviour changes:
afterCloseget one per close.beforeOpenbut noafterOpen.open()on a dropdown already opening or open fires nothing.position-*class or an inline transform before its first open.Other information
tooltip-plugin). Its record mode refuses on this code, which no longer haspopover-plugin; re-record on master.cypress/e2e/dropbox-lifecycle.cy.tspins the interrupted transitions, repeated opens, real clicks inside a shadow-root instance, the shadow-root and slotted hosts, and which transforms trigger a re-measure.