-
-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow developers to declare a "dummy" link-to #106
Comments
I think the plan here to have a router service and then decompose the existing |
Yup! |
Yes, that is the plan as I see it...
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Currently, there is no simple, foolproof way to declare a "dummy"
link-to
, i.e. one which appears on the page, receives the active class when its route (or a child route thereof) is current, but is never invoked as a result any event being triggered.Real-world scenario
Developers want to create dropdown menus with links to child routes. They depend on Ember to add a class when the route or one of its children is current (the default class is "active") and have styles be applied by a CSS framework such as Twitter's Bootstrap. In the case of bootstrap, this is usually done with a
link-to
wheretagName
is set toli
, and a plaina
element is embedded within theli
. By default, clicking on theli
will transition to its url, although developers simply want clicking to open a dropdown menu containing child links, allowing users to navigate to a more specific part of the app.Proposed solution
Allow developers to set an argument indicating the
link-to
should never be invoked. This could be done with a parameter named (for example)neverInvoke
which defaults tofalse
and indicates whether thelink-to
is for display only.In the
init()
method for LinkComponent, ifneverInvoke
is true,eventName
will not be bound to the_invoke()
method.Drawbacks
This increases the API surface area of
link-to
, and adds some complexity to the implementation ofLinkComponent
. Also, the number of people needing this feature is unknown.Alternative solutions
eventName
tonever
. This feels like a hack, and developers will have to be directed to naming the event in a way which ensures it will never be triggered. Also, while the performance hit of attaching one "dead" event listener is negligible, allowing this to proliferate throughout large apps seems irresponsible.LinkComponent
and override theinit()
method so it removes the event listener. But since the default event name isclick
, this may have unintended side-effects if the developer does not changeeventName
to something likenever
, as in the first approach.The text was updated successfully, but these errors were encountered: