Repository navigation
[@mantine/core] PhoneInput: Hide the country selector when only one country is available - #9582
Open
sernstberger wants to merge 1 commit into
Open
sernstberger wants to merge 1 commit into
sernstberger wants to merge 1 commit into
Conversation
…ountry is available Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #9580.
Problem
A single-country phone input still shows the country button and dropdown, which has nothing to choose from. The only way to remove it today is passing
leftSection, which replaces the button by accident and keeps its pointer events and width.Changes
onlyCountries/excludeCountriesleave one country, the country button and dropdown are not rendered, andleftSectionis free for the app.defaultCountry. Otherwise there would be no country and no way to pick one.onlyCountries={['us']}+ a phone icon inleftSection).No new props. With two or more countries nothing changes.
Validation
npm run jest packages/@mantine/core/src/components/PhoneInput: 319 passed, including 2 new tests (the regression test for selecting the only country fails without the fix)leftSection, the dropdown stays hidden withdropdownOpened, Tab skips straight to the input, the button appears and disappears whenonlyCountrieschanges at runtime, unknown ISO codes are ignored, and disabled/readOnly work.HomePageSponsors.tsx, is also on master)🤖 Generated with Claude Code