Skip to content

[mobile] test mobile fix#21

Closed
divazbozz wants to merge 7 commits intomainfrom
dz/mobile_fix
Closed

[mobile] test mobile fix#21
divazbozz wants to merge 7 commits intomainfrom
dz/mobile_fix

Conversation

@divazbozz
Copy link
Contributor

@divazbozz divazbozz commented Jan 26, 2026

  • Problem

    • On mobile /get-started, the address search input was incorrectly positioned - floating in the middle of the page instead of its correct location.
    • The existing architecture always rendered the input in a portal with position: absolute, requiring JavaScript to continuously sync its position with a hidden placeholder.
  • suspicion

  • This broke on /get-started because Webflow likely uses CSS transform for animations, which creates a new containing block for absolute positioning - making our calculated coordinates wrong.

Changes

Changed to "portal only when active" architecture:

  • Default state: Input is a visible button in normal document flow - browser handles positioning

  • Activated state (user clicks): Portal created with position calculated at that moment and continuous resizing

  • Refactored Autocomplete.tsx

    • Input now in normal document flow by default (not always portaled)
    • Portal + overlay only created when user activates the input
    • Renamed ComboBoxOverlayActivatedOverlay
  • Fixed mobile Safari focus issue

    • Changed from useEffect to callback ref for focusing input.
  • Simplified OverlayPosition type

  • only top, left, width needed.

Test

  • Before (on basepowercompany.com), see when we navigate to "get-started" the overlay component
ScreenRecording_01-26-2026.19-05-01_1.MP4
  • After (on staging)
ScreenRecording_01-26-2026.19-03-52_1.MP4

zIndex: number;
value: string;
placeholder?: string;
placeholder: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

placeholder can be nonnull as we always pass in "Enter your address" as default

Copy link
Contributor

Choose a reason for hiding this comment

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

The intention is that the Autocomplete component is generic and could be used for other things where we may not always want a placeholder

Comment on lines -93 to -97
if (e.key === "ArrowDown" && results.length > 0) {
e.preventDefault();
open();
setHighlightedIndex(0);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer needed

@divazbozz divazbozz requested a review from bkobelan January 27, 2026 01:32
@yxxh
Copy link

yxxh commented Jan 27, 2026

nice thanks dz

Copy link
Contributor

@bkobelan bkobelan left a comment

Choose a reason for hiding this comment

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

Changed to "portal only when active" architecture
I originally had this but we had many more bugs on iOS due to some focus issues and requiring two taps to bring up the keyboard.

I wanna play around with this before we merge. Do you have a link of where it is on staging?

zIndex: number;
value: string;
placeholder?: string;
placeholder: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

The intention is that the Autocomplete component is generic and could be used for other things where we may not always want a placeholder

Comment on lines +67 to +73
// This is more reliable than useEffect for mobile Safari
const setInputRef = useCallback((el: HTMLInputElement | null) => {
inputRef.current = el;
if (el) {
el.focus();
}
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure this works well? on safari you can't programmatically focus an input that is not triggered by a click event. Looking at the code, this is triggered by a render which wouldn't qualify for being able to focus and show the keyboard.

@divazbozz divazbozz closed this Jan 27, 2026
@divazbozz
Copy link
Contributor Author

abandon, see #23

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