Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide focus style customization #189

Closed
chris-verclytte opened this issue Sep 30, 2018 · 3 comments
Closed

Provide focus style customization #189

chris-verclytte opened this issue Sep 30, 2018 · 3 comments

Comments

@chris-verclytte
Copy link

chris-verclytte commented Sep 30, 2018

Hello,

What would you think about adding some way to customize the focus state of the component ?
I have not found any hook that would allow to do this currently.
What I am willing to do is applying a common border for both country selector and phone input but currently when you focus phone input, only this one is focused and there is no way to hook on a CSS className or other mechanism to customize this.
Here is a preview of what I get:
capture d ecran 2018-09-30 a 12 45 00

I think the easier way would be to put a 'react-phone-number-input--focused' className on the root component (here), this would allow to apply focus state on both country selector and phone input.
Another solution would be to provide ref hooks for input and select but I think this is trickier.

What do you think ? I can do a PR if this seems legit.

@catamphetamine
Copy link
Owner

catamphetamine commented Sep 30, 2018

Try setting position: absolute for country select and then move it to the left side of the <input/> and add padding-left to the <input/>.

@chris-verclytte
Copy link
Author

Yeah sure, it would be possible to do it CSS-way, but I think this could belong to the library as it is pretty common case. Here the country selector is like an adornment on an input field, then I think it makes sense to say that the whole component is focused (with the className) when the phone input is focused, isn't it ?

catamphetamine pushed a commit that referenced this issue Sep 30, 2018
@catamphetamine
Copy link
Owner

Released react-phone-number-input@2.2.9

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

No branches or pull requests

2 participants