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

Add placeholder support to Select #298

Closed
bitpshr opened this issue Sep 6, 2017 · 4 comments
Closed

Add placeholder support to Select #298

bitpshr opened this issue Sep 6, 2017 · 4 comments
Assignees
Milestone

Comments

@bitpshr
Copy link
Member

bitpshr commented Sep 6, 2017

Enhancement

It would be nice to be able to add a placeholder to Select.

Package Version: latest

Expected behavior:

w(Select, {
	placeholder: 'Choose an option',
	options: dataSmall,
	value: selectValue,
	onChange: (option: OptionData) => {
		this.setState({ selectValue: option.value });
	}
})

Actual behavior:

w(Select, {
	options: dataSmall,
	value: selectValue,
	onChange: (option: OptionData) => {
		this.setState({ selectValue: option.value });
	}
})
@bitpshr bitpshr mentioned this issue Sep 6, 2017
3 tasks
@dylans dylans added this to the 2017.09 milestone Sep 7, 2017
@smhigley
Copy link
Contributor

smhigley commented Sep 12, 2017

This was initially left off because native Select doesn't support a placeholder. It's easy to add for the custom single-select, but how should it work for native single-select? I think the options are either:

  1. Make the first option a selected disabled option
  2. Have a separate <span> present and absolutely positioned over the input if no option is selected / value is undefined

I'm more in favor of (2), since IMO a placeholder shouldn't affect the actual options, but I know a lot of people use (1) as a select placeholder hack

@bitpshr
Copy link
Member Author

bitpshr commented Sep 14, 2017

I vote for leaving out placeholder support for native selects altogether. It's tough to use the span trick reliably across mobile browsers since their UIs are all implemented differently. If we need to support this property for native mode, I vote for option 2.

@kitsonk kitsonk modified the milestones: 2017.09, 2017.10 Sep 29, 2017
@bitpshr
Copy link
Member Author

bitpshr commented Oct 23, 2017

I spoke again with @smhigley and we decided placeholder support for custom, non-native Select components makes sense for beta4.

@bitpshr
Copy link
Member Author

bitpshr commented Nov 10, 2017

🚀🚀🚀

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

No branches or pull requests

4 participants