question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to pass arbitrary attributes into the trigger

See original GitHub issue

I need to pass a data-test-... attribute into the trigger.

Looks like this is impossible to do.

Please pass splattributes (or some pre-Octane equivalent) into the trigger.

Or give the wrapper component a tag.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
lolmauscommented, Mar 30, 2020

@cibernox In the mental model of any user who’s not got elbow deep into the ember-power-select source, is different from yours. What new Power Select users see is a component:

<PowerSelect>
</PowerSelect>

They don’t see a “trigger”, a “content”, a “wormhole”, whatever. They see a component called PowerSelect.

And every new user has an expectation that applying attributes on it will work. This is how every component in the Ember ecosystem works, and Power Select is probably the only one that breaks the expectation — and does so without warning. The behavior of dropping attributes/splattributes/modifiers is not documented, so you need to research its source to learn that <PowerSelect> is tagless and does not pass splattributes to the rendered component (Trigger).

Why does it not pass attributes to the rendered component? Because ideally you should be able to apply splattributes to the Content component, so… you get nothing?

Yes, trigger and content elements customization are also legit cases, but passing attributes to the Power Select component itself (what you call Trigger under the hood) is a much, much more common necessity.

I don’t see how a feature request for customizing the Content prevents from solving a source of pain for many Power Select users.


I’m speculating here, but I believe that every ember-test-selectors user who needed to acceptance-test a Power Select has spend at least two hours on this problem. And ember-test-selectors has ~250 000 installs per month, so that’s a lot of hours of frustration.

And ember-tests-selectors is just one of many reasons why you need attributes/modifiers on a Power Select. There are many more.


Also please note that there is a RFC in progress called “Splat Areas”: https://github.com/emberjs/rfcs/issues/517. It aims to solve the same problem that you pointed out, but in a more general way. It’s in an early stage, but still I believe it makes little sense to undertake a custom solution when a general solution is on the way. We should rather join forces over the RFC.

Please see if the RFC issue in its current way satisfies your needs. If it doesn’t, please express what it’s lacking and why, and suggest an alternative implementation if you can. If it does satisfy you needs, please encourage to promote it into a PR.

4reactions
rwwagner90commented, Apr 13, 2020

This issue is blocking ember-bootstrap-power-select as well https://github.com/kaliber5/ember-bootstrap-power-select/issues/93. Anything I can do to help fix things? If the PR @lolmaus opened works, I would love if we could get it merged!

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS Cognito: Unable to signup with custom attributes in ...
I am trying to signup an user. I am using AWS cognito for user authentication and authorization. I have added new custom attribute...
Read more >
Pass trigger information to pipeline - Azure Data Factory
In Azure Data Factory, we use Parameterization and System Variable to pass meta data from trigger to pipeline.
Read more >
Adding custom attribute to Cognito user pool ... - GitHub
This seems to be completely associated with adding custom attributes. I've seen this happen twice now (I actually have two custom attributes, ...
Read more >
How to Access Custom Attributes from Event Object in React
This can be useful when you have to retrieve a custom value from a data source using a trigger, such as a button...
Read more >
Migrate user Lambda trigger - Amazon Cognito
When a user doesn't exist in the user pool at sign-in with a password, or in the forgot-password flow, Amazon Cognito invokes this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found