Skip to content

fix: track visualViewport continuously during scroll lock#273

Open
sun-mota wants to merge 1 commit into
mainfrom
sunMota/floatingui-bib-cut-with-vkb
Open

fix: track visualViewport continuously during scroll lock#273
sun-mota wants to merge 1 commit into
mainfrom
sunMota/floatingui-bib-cut-with-vkb

Conversation

@sun-mota

@sun-mota sun-mota commented Jul 22, 2026

Copy link
Copy Markdown
Member

Alaska Airlines Pull Request

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Checklist:

  • My update follows the CONTRIBUTING guidelines of this project
  • I have performed a self-review of my own update

By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.

Thank you for your submission!

-- Auro Design System Team

@sun-mota sun-mota self-assigned this Jul 22, 2026
@sun-mota
sun-mota requested a review from a team as a code owner July 22, 2026 20:37

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @sun-mota, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the scroll-lock implementation in AuroFloatingUI to keep fullscreen bib positioning in sync with iOS visualViewport changes (notably during virtual keyboard interactions), preventing the bib from drifting when the viewport pans.

Changes:

  • Switch from a one-time visualViewport.offsetTop adjustment to continuous tracking via visualViewport resize + scroll listeners while scroll is locked.
  • Add teardown logic to remove the visualViewport listeners when unlocking scroll.
  • Stop forcing .container maxHeight to visualViewport.height during fullscreen strategy setup (now resets to default instead).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/runtime/floatingUI.mjs
Comment thread scripts/runtime/floatingUI.mjs
@sun-mota
sun-mota force-pushed the sunMota/floatingui-bib-cut-with-vkb branch from 88537cc to 85e9b35 Compare July 22, 2026 20:45
@sun-mota
sun-mota requested a review from Copilot July 22, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

scripts/runtime/floatingUI.mjs:370

  • The new visualViewport tracking logic (RAF-throttled scroll/resize listeners + unlock cleanup) introduces non-trivial behavior that isn't covered by the existing lockScroll tests. Consider adding a focused unit test that stubs window.visualViewport (with add/removeEventListener + offsetTop) and verifies: (1) listeners are registered on lock, (2) transform updates are applied via RAF when scroll/resize fires, and (3) listeners + any pending RAF are cleaned up on unlock.
        if (window.visualViewport) {
          this._viewportRafId = undefined;
          this._viewportHandler = () => {
            if (this._viewportRafId !== undefined) {
              return;
            }
            this._viewportRafId = requestAnimationFrame(() => {
              this._viewportRafId = undefined;
              if (element?.bib) {
                element.bib.style.transform = `translateY(${window.visualViewport.offsetTop}px)`;
              }
            });
          };
          window.visualViewport.addEventListener(
            "resize",
            this._viewportHandler,
          );
          window.visualViewport.addEventListener(
            "scroll",
            this._viewportHandler,
          );
          this._viewportHandler();

@rmenner

rmenner commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Dev release of this PR:

@aurodesignsystem-dev/auro-library@0.0.0-pr273.0

@sun-mota

Copy link
Copy Markdown
Member Author

DRAFT PR for testing in auto-formkit: AlaskaAirlines/auro-formkit#1571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants