Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSet a default selected object, if no "prompt" exists or if no default selection binding exists. #10997
Conversation
added some commits
Apr 30, 2015
grapho
referenced this pull request
Apr 30, 2015
Closed
Ember.Select auto-selects the last <option> by default in Firefox Browser #10984
added some commits
May 1, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
grapho
May 1, 2015
@rwjblue @mixonic ... well I tried... and Travis kicked my butt. He is very thorough.
I think it is close, but there are a few subtleties I am missing.. causing the build to fail.
The work around was not as straightforward as i originally thought.
Could I get a couple eyes on it to see what i missed?
grapho
commented
May 1, 2015
|
@rwjblue @mixonic ... well I tried... and Travis kicked my butt. He is very thorough. I think it is close, but there are a few subtleties I am missing.. causing the build to fail. The work around was not as straightforward as i originally thought. Could I get a couple eyes on it to see what i missed? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mixonic
May 2, 2015
Member
I have unwound this same ball of wax :-/ I have not tried your approach of just cleaning up the bad behavior after render.
I don't suggest doing this in setDefaults unless it is used exclusively in didInsertElement. I'm not sure how you can do this though- the selectedIndex is already set to a non -1 value in didInsertElement and I'm not sure how you can know that it is not to be trusted.
|
I have unwound this same ball of wax :-/ I have not tried your approach of just cleaning up the bad behavior after render. I don't suggest doing this in |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
grapho
May 4, 2015
@mixonic setDefaults() is actually called exclusively on didInsertElement via its init method and changing the selection property triggers an observer to set the selectedIndex afterward in selectionDidChangeSingle and setSelectedIndex methods. It seemed like it would work fine and indeed it seems to in real life.. though travis seemed to find a singular failed test in a case where the selection binding was bound to a value of "0"?
All that being said... I am willing to drop the issue here, because it seems to be more of a browser/rendering issue for chrome as you said? Coding to compensate for that does not seem to be the long term solution.
grapho
commented
May 4, 2015
|
@mixonic All that being said... I am willing to drop the issue here, because it seems to be more of a browser/rendering issue for chrome as you said? Coding to compensate for that does not seem to be the long term solution. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
stefanpenner
Jul 8, 2015
Member
Select is deprecated for 2.0. If there is interest in making this work in the 1.13 branch, feel free to let me know and I will gladly reopen.
FYI: as of 1.13.3 you can just use the DOM via HTMLBars directly to get some really slick and wonderful selects example
|
Select is deprecated for 2.0. If there is interest in making this work in the 1.13 branch, feel free to let me know and I will gladly reopen. FYI: as of 1.13.3 you can just use the DOM via HTMLBars directly to get some really slick and wonderful selects example |
grapho commentedApr 30, 2015
Related to issue: #10984
This workaround should solve an issue where an
Ember.Selectwill default to the last array object (or<option>) in certain browsers.THis issue would occur for single type Ember.Selects which have no "prompt" property defined, and a selection or value property bound to a null value.
This is done in the
_setDefault()method, and onlyon('didInsertElement').. allowing all the correct observers to fire and not interfere with subsequest selection changes.