ember-power-select icon indicating copy to clipboard operation
ember-power-select copied to clipboard

Add `title` attribute to options that are too long and are trimmed by the CSS ellipsis

Open cibernox opened this issue 8 years ago • 5 comments
trafficstars

It would be a nice addition to, after the options have been rendered, schedule a task that checks what options are too long and get trimmed by the CSS ellipsis, so people can see the full text if they hover the options.

As it is a bit of an edge case and everything related with DOM measuring can be expensive, it must be an opt-in. Also, it would be nice if it could leverage requestIdleCallback to never slow down the UI for something that is not urgent, as the user would have to hover an option for a while to display a title.

cibernox avatar Nov 07 '17 18:11 cibernox

Ran into this situation today, would be very useful. Short of that, opting into a title attribute that is always used for the ember-power-select-selected-item would be an easy win for us.

jbryson3 avatar Jun 27 '18 20:06 jbryson3

Noted. I may explore the idea soon, but I don't have a exact timeframe.

cibernox avatar Jun 27 '18 20:06 cibernox

Had a requirement for this one too. We pulled in https://github.com/cibernox/ember-power-select/blob/master/addon/components/power-select/options and its template in our code base. Added title={{opt.whateverValue}}in here https://github.com/cibernox/ember-power-select/blob/master/addon/templates/components/power-select/options.hbs#L26

This is like a workaround. Will get it for all options instead of just the ones that are trimmed off by an ellipsis. You can of course add it as a conditional property.

neeleshsaxena avatar Jul 17 '19 15:07 neeleshsaxena

It's not a workaround really. As of today it is expected that if you want to customize the options of the list you pass your own custom optionsComponent to replace the default one. Usually, and this seems to be your case, just a tiny customization to the template is enough to do what you want.

cibernox avatar Jul 17 '19 15:07 cibernox

Right. That's what I did, added my own optionsComponent. Didn't mean it as a workaround for this issue particularly. I came across this issue while searching for solutions and I thought anyone else looking at something like this could benefit. On another note, maybe now that I have your attention, you could take a peek at https://github.com/cibernox/ember-power-select/issues/1236 and comment. 😃

neeleshsaxena avatar Jul 17 '19 15:07 neeleshsaxena