btecu / ember-cli-bootstrap-datetimepicker

Ember date time picker addon
MIT License
20 stars 51 forks source link

showIcon=false causes an exception #79

Open jaurand opened 4 years ago

jaurand commented 4 years ago

If you set showIcon to false then you get the following exception when opening the picker:

bootstrap-datetimepicker.js:426 Uncaught TypeError: Cannot read property 'top' of undefined
    at place (bootstrap-datetimepicker.js:426)
    at Object.show (bootstrap-datetimepicker.js:1254)
    at Class.focus (bs-datetimepicker.js:113)
    at Backburner._run (backburner.js:758)
    at Backburner._join (backburner.js:736)
    at Backburner.join (backburner.js:477)
    at Function.run.join (ember-metal.js:4366)
    at action.js:364
    at exports.flaggedInstrument (ember-metal.js:3920)
    at HTMLInputElement.<anonymous> (action.js:363)

I think this is because the input-group class is always added, but it's only needed if the icon is rendered.

henkkasoft commented 3 years ago

Noticed the same problem. I removed the showicon=false and hide it in scss with input-group-addon display: none

.date {
  .input-group-addon {
    display: none;
  }
}
btecu commented 3 years ago

Can you create a reproduction in an ember-twiddle or something?

henkkasoft commented 3 years ago

Sorry, I am a little busy just now, maybe later I have time to try to reproduce.

This is how the component is called when the problem occur: {{bs-datetimepicker date=model.startAt allowInputToggle=true showIcon=false}}

"ember-cli-bootstrap-datetimepicker": "^0.9.3",