Closed mrDarcyMurphy closed 9 years ago
hey @mrDarcyMurphy. the module is geared to show the label based on presence of the label el, regardless of the label content. same thing goes for the validation messages & message containers. in your app, rather than setting the label to the empty string, can you instead just hide the label? both still one line calls--selectView.el.querySelector('[data-hook~=label]').style.display = 'none'
A more strict check for opts.label being undefined could mitigate this. set opts.label to '' and it won't override.
Ah, I see. When it was "stated doesn't show up", I was literally thinking the node itself. We should def add the undef check
Would really like to see this in 4.0.0 so waiting a bit before releasing.
i'll push somethin momentarily to review
Thanks, guys. Sorry for the confusion, @cdaringe.
I still think that setting the label
to the name
is counter-intuitive though. /twocents
This is the right time to bring it up. If there's no label should we just leave the label DOM alone?
@mrDarcyMurphy, nah, you're cool, it was me reading hastily that led to my own befuddled-ness
@all, it is possible that styles against the text-less node get rendered, which was my original comment suggested to hide the node. i can see people both wanting the node present consistently for a simple contract of when the node is present, and people not wanting it for possible aesthetics.
it's more overhead, but maybe we toggle it's display to 'none'
when label
is falsy, that way all potential needs can be satisfied?
@cdaringe Sorry for the late reply, been busy shipping.
I think that toggling the label's display is better than putting the name in. It's also consistent with ampersand-input-view
that way.
Line 38:
The way I'm using the select-view, when I deliberately set the label to nothing that means I don't want a label to appear. Additionally, the
name
I pass into the select-view options usually matches the model attribute and is rarely (if ever) a human friendly string.If it has to be a string, then at least set it to one. I know an empty string returns
false
, but I didn't see any further check, and this way it would at least avoid unintended side effects of setting it to thename
.