-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Selectlist select none #677
Selectlist select none #677
Conversation
I still don't see how this is any different from just defining the placeholder on the field config? I don't think we need both Select All and Select None options at all times when we can achieve the same behaviour with just the Select all option.
What about adding an empty option (if not already present) to the list when nothing is selected (when Select All is deselected and when the field is loaded with no selected options) |
With the last commits select none is the placeholder/empty option? So is the same as adding an empty option. Maybe I’m misunderstanding what you mean. |
Yea I mean adding it in the background like a hidden input or disabled empty option? |
Updated, let me know what you think |
Ok, I think we're actually changing the normal behaviour of the select field. The select field only appears in the POST data when it has selected options just like checked inputs. Forcing an empty string array when no option is selected would actually break components using the selectlist field. If you take the FeaturedMenus component for example. With this PR implemented when you save the component with no menu items selected, you get an empty string array which might break the frontend. |
Could we make it a field config option? Not sure what the other option is as some fields can’t be reverted as things stand.
… On 29 Jan 2021, at 20:15, Sam Poyigi ***@***.***> wrote:
Ok, I think we're actually changing the normal behaviour of the select field. The select field only appears in the POST data when it has selected options just like checked inputs.
Forcing an empty string array when no option is selected would actually break components using the selectlist field.
If you take the FeaturedMenus component for example. With this PR implemented when you save the component with no menu items selected, you get an empty string array which might break the frontend.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Yup, that would work to force an empty option value... But then you can do the same with the placeholder option.. I think I still don't fully understand the issue here. |
That’s ok I’ll try and explain. Placeholder works as part of the fix but say I set the value to ‘none’, then it still keeps everything else selected when chosen. So you can have none and other values. From a user point of view that feels strange. What about a config option ‘selectEmptyClearsSelection’ - which then uses the logic here - so in my example selecting none would clear all other values. And none is added via the placeholder if specified or the hidden field otherwise. |
Ahh, so would attach some kind of event on the placeholder option so that its the only selected option when chosen? The hidden input just doesn't feel right. |
Yes - if you look at the removed code in this commit, thats basically what it was doing originally :) We just hide it behind a config option instead of making it default? |
Yea didn't understand the issue then lol. So if the only issue is not being able to select none when a placeholder is defined, then maybe revert to 90600a8 and we won't need the hidden input or a config option as all we need to fix is deselecting the other options when the placeholder is selected. |
No prob. I’ll revise and test - will let you know when it’s ready for another review.
… On 30 Jan 2021, at 14:11, Sam Poyigi ***@***.***> wrote:
Yea didn't understand the issue then lol.
So if the only issue is not being able to select none when a placeholder is defined, then maybe revert to 90600a8 and we won't need the hidden input or a config option as all we need to fix is deselecting the other options when the placeholder is selected.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Should we merge this @sampoyigi if not there is an UI fix for select list zindex to cherry pick |
Yea you can send another PR for the z-index fix. I'll leave this one until am sure it doesn't break something else, just like this reverted commit 874aad7. |
Initial idea - basically make placeholder always there (obviously need to add lang string for default for this but havent done that yet) and change it to be 'select none'.
Then made the various events toggle between select all and select none.