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.

disabledClass of link-to component might not work, depending on attributes order

See original GitHub issue

link-to component has not documented property disabledClass which is supposed to change class of disabled link. I see that it’s marked as private but sometimes this feature is needed. When I set disabledClass to some value, I expect link to have that class. But following code does not work as expected (expected link to have class some-class, in fact it has disabled class and not some-class):

{{#link-to 'parent' tagName='div' class='item' disabled=true disabledClass='some-class'}}
  <div class="header">Menu Item</div>
  <div class="menu">
    {{link-to 'Sub-menu Item 1 ' 'parent.child-1' class='item'}}
    {{link-to 'Sub-menu Item 2 ' 'parent.child-2' class='item'}}
  </div>
{{/link-to}}

And this code works just fine:

{{#link-to 'parent' tagName='div' class='item' disabledClass='some-class' disabled=true}}
  <div class="header">Menu Item</div>
  <div class="menu">
    {{link-to 'Sub-menu Item 1 ' 'parent.child-1' class='item'}}
    {{link-to 'Sub-menu Item 2 ' 'parent.child-2' class='item'}}
  </div>
{{/link-to}}

I think it works this way:

  1. classNameBindings contains disabled
  2. disabled is defined as a computed property without dependent keys and has a setter which returns disabledClass
  3. In first example setter of disabled property is called before disabledClass is changed from default value disabled to some-class

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
boris-petrovcommented, Oct 13, 2021

@sandstrom - I just tested this on Ember 3.28.1 and the issue is still there so please do not close the issue.

0reactions
sandstromcommented, Oct 13, 2021

I’m doing some issue gardening 🌱🌿 🌷 and came upon this issue. Since it’s quite old I just wanted to ask if this is still relevant? If it isn’t, maybe we can close this issue?

By closing some old issues we reduce the list of open issues to a more manageable set.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disable a vuejs router-link? - Stack Overflow
There is nothing built in, and probably won't ever be. ... the disabled attribute, but one trick would be using tag="button" in order...
Read more >
How to Disable Links | CSS-Tricks
There is a problem though: there is no real way to disable an <a> link (with a valid href attribute) in HTML. Not...
Read more >
Deprecations Added in Ember 3.x
The deprecated copy function now handles array copies directly, no longer delegating to NativeArray.copy . With this deprecation, NativeArray no longer inherits ...
Read more >
disabled - CSS: Cascading Style Sheets - MDN Web Docs
The :disabled CSS pseudo-class represents any disabled element. An element is disabled if it can't be activated (selected, clicked on, ...
Read more >
doc - intercooler.js - Simple AJAX using HTML attributes
Intercooler depends on JQuery, version 1.10.0 or higher, and is ... The attributes above are defined in terms of ic-src , you will...
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