Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(experience): fix country code dropdown positioning in account center#8078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
wangsijie wants to merge1 commit intomaster
base:master
Choose a base branch
Loading
fromwangsijie-log-12600-the-position-of-country-code-menu

Conversation

@wangsijie
Copy link
Contributor

@wangsijiewangsijie commentedDec 16, 2025
edited
Loading

Summary

  • Fix country code dropdown appearing at top-left of page instead of near the phone input field in account center

Root Cause

TheinputRef prop was passed asinnerRef.current which evaluates tonull on initial render (before the ref is attached to the DOM). This caused theupdatePosition function to set an empty position object{}, resulting in the dropdown defaulting to top-left positioning.

Fix

Pass the ref object itself instead of.current so the dropdown can access the current input element when it actually opens, rather than receiving the stalenull value from initial render.

Test plan

Screenshot 2025-12-16 at 2 54 42 PM

Pass the ref object instead of ref.current to ensure the dropdown canaccess the current input element when it opens, rather than receivingthe stale null value from initial render.
CopilotAI review requested due to automatic review settingsDecember 16, 2025 05:56
@github-actions
Copy link

COMPARE TOmaster

Total Size Diff 📉 -88 Bytes

Diff by File
NameDiff
packages/experience/src/shared/components/InputFields/SmartInputField/CountryCodeSelector/CountryCodeDropdown/index.tsx📉 -43 Bytes
packages/experience/src/shared/components/InputFields/SmartInputField/CountryCodeSelector/index.tsx📉 -37 Bytes
packages/experience/src/shared/components/InputFields/SmartInputField/index.tsx📉 -8 Bytes

Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a positioning bug where the country code dropdown appeared at the top-left of the page instead of below the phone input field in the account center. The root cause was passinginnerRef.current (which evaluates tonull during initial render) instead of the ref object itself, preventing the dropdown from calculating the correct position.

Key changes:

  • ChangedinputRef prop from passinginnerRef.current toinnerRef in SmartInputField
  • Updated type definitions fromNullable<HTMLInputElement> toReact.RefObject<HTMLInputElement | undefined> in CountryCodeSelector and CountryCodeDropdown
  • Updated theupdatePosition callback to accessinputRef.current.parentElement instead ofinputRef.parentElement, and fixed the dependency array

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

FileDescription
packages/experience/src/shared/components/InputFields/SmartInputField/index.tsxChanged to pass the ref object (innerRef) instead of its current value (innerRef.current) to CountryCodeSelector
packages/experience/src/shared/components/InputFields/SmartInputField/CountryCodeSelector/index.tsxUpdated type definition forinputRef prop fromNullable<HTMLInputElement> toReact.RefObject<HTMLInputElement | undefined> and removed unused import
packages/experience/src/shared/components/InputFields/SmartInputField/CountryCodeSelector/CountryCodeDropdown/index.tsxUpdated type definition forinputRef prop, corrected access to parent element viainputRef.current.parentElement, and fixed useCallback dependency array to use the ref object

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

readonlyclassName?:string;
readonlyvalue?:string;
readonlyinputRef?:Nullable<HTMLInputElement>;
readonlyinputRef?:React.RefObject<HTMLInputElement|undefined>;

Choose a reason for hiding this comment

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

The type definition should beReact.RefObject<HTMLInputElement> instead ofReact.RefObject<HTMLInputElement | undefined>. The ref object created withuseRef<HTMLInputElement>(null) has typeReact.RefObject<HTMLInputElement>, where the.current property can benull orHTMLInputElement, but the generic parameter itself should not includeundefined.

Suggested change
readonlyinputRef?:React.RefObject<HTMLInputElement|undefined>;
readonlyinputRef?:React.RefObject<HTMLInputElement>;

Copilot uses AI. Check for mistakes.
readonlycountryCode:string;
readonlycountryList:CountryMetaData[];
readonlyinputRef?:Nullable<HTMLInputElement>;
readonlyinputRef?:React.RefObject<HTMLInputElement|undefined>;

Choose a reason for hiding this comment

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

The type definition should beReact.RefObject<HTMLInputElement> instead ofReact.RefObject<HTMLInputElement | undefined>. The ref object created withuseRef<HTMLInputElement>(null) has typeReact.RefObject<HTMLInputElement>, where the.current property can benull orHTMLInputElement, but the generic parameter itself should not includeundefined.

Suggested change
readonlyinputRef?:React.RefObject<HTMLInputElement|undefined>;
readonlyinputRef?:React.RefObject<HTMLInputElement>;

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@charIeszhaocharIeszhaocharIeszhao approved these changes

Assignees

@wangsijiewangsijie

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@wangsijie@charIeszhao

[8]ページ先頭

©2009-2025 Movatter.jp