#16780 closed defect (invalid)
CheckBox: no id on top node
Reported by: | Paul Christopher | Owned by: | Paul Christopher |
---|---|---|---|
Priority: | undecided | Milestone: | tbd |
Component: | Dijit - Form | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
See attached test case: The test page contains a checkbox which is created declaratively and which is initally hidden by "display:none".
By clicking on a button,
domStyle.set('mycheck', 'display', 'inline-block');
is called -- without any visible effect: The checkbox is still hidden.
Reason: The wrapping div of a dijit/CheckBox does have no id, but only a widgetid. Only the input element has an id. Calling domStyle makes the input (child) visible, but since its parent container (the widgets top level DOM node/ wrapping div)is still hidden, nothing shows up on the screen.
Attachments (1)
Change History (6)
comment:1 Changed 8 years ago by
Summary: | Cannot show initially hidden checkbox → CheckBox: no id on top node |
---|
Changed 8 years ago by
Attachment: | testCheckbox.htm added |
---|
comment:2 Changed 8 years ago by
Owner: | changed from Douglas Hays to Paul Christopher |
---|---|
Status: | new → pending |
paul christopher,
as you mentioned currently the widget's id is applied to the input element that is part of the template - this is what makes clicking on labels work like they do for native checkbox inputs. if an id was applied to the domNode, it would need to be a different id than the widget's id (i wouldn't want to lose the ability to click labels) so i'd say that bill's approach is still the simplest.
do you have another suggestion?
comment:3 Changed 8 years ago by
Status: | pending → new |
---|
neonstalwart,
you are perfectly right: Removing the id from the input and putting it on the top-level domNode might remove the ability to check/uncheck the checkbox by clicking on the label.
So Bill's suggestion to use widget.domNode is maybe the only solution -- although maybe not the most intuitive one -- but by design, it is not possible to change this, I guess.
comment:4 Changed 8 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
it sounds like there isn't a better solution so i'll close this ticket.
comment:5 Changed 8 years ago by
What I meant was to add id="widget_${id}" to the root node, as is done for the TextBox widgets (see DropDownBox.html, Spinner.html, and ValidationTextBox.html). The change is trivial and safe.
OTOH it's not done in *Button.html or *Slider.html, and it's unclear why it's done for TextBox widgets, see [9758] and [21560]. So perhaps we are better off removing the extra id for those widgets.
You can do:
But since the TextBox subclasses all have id's on their top nodes, probably checkbox should do it too for consistency.