GithubHelp home page GithubHelp logo

Comments (6)

SanderKnauff avatar SanderKnauff commented on July 19, 2024 1

Got it. Moving to <BsNav> is not possible.

I wonder if it is needed anymore at all. It seems to be used to set active and disabled CSS classes on <li class="nav-item">.

I cannot find having active or disabled CSS class on <li class="nav-item"> for Bootstrap 4 or 5 in Bootstrap's documentation. I can only find it in Bootstrap 3. In Bootstrap 4 and 5 the active and disabled CSS classes are on the <a> element, which is rendered by <BsLinkTo> itself.

Unless I missed something the code seems to be a leftover from Bootstrap 3 support, which we missed to remove. Would be great if you could double check as well.

Assuming I haven't missed something, I would recommend doing 2 PRs:

  1. Removing active and disabled CSS classes from <li class="nav-item"> and all code related to it.
  2. Refactoring <BsNav::Item> to Glimmer component, which should be unblocked after we landed the cleanup in first step.

I prefer two PRs to highlight the markup change more prominently in changelog. I don't think it's a breaking change. I would consider that HTML private implementation detail and not matching markup from Bootstrap docs as a bug. But clearly documenting the change might be good anyways.

Yup, after investigating, I also can only see evidence of it being used for BS3 support. I've created a PR to remove the binding between the two

from ember-bootstrap.

SanderKnauff avatar SanderKnauff commented on July 19, 2024

For the BsNav::Item and BsLinkTo I ran into an issue with the way parent/child lookups are being done.

In most of the new code, we pass through registerChild/unregisterChild functions from the parent to the child.
The old code relies on Ember for finding the nearest component of a type using the nearestOfType function.

Due to the way Bs::Nav yields children, it is not possible to have it exactly the same way in glimmer. Namely, the following situation will cause issues:

<BsNav as |nav|>
  <nav.item>
    <nav.link-to @route='application'>Dummy</nav.link-to>
  </nav.item>
</BsNav>

We have no way of telling the nav.link-to that it should register itself as a child of nav.item.

What should we do in this situation?

from ember-bootstrap.

jelhan avatar jelhan commented on July 19, 2024

Thanks a lot for investigating.

I think the root cause is that the <BsLinkTo> component is yielded from <BsNav>. But it should be yielded from <BsNav::Item> as it is expected to be used as a child of that one.

Changing which component yields <BsLinkTo> would be a breaking change. And would require touching all usages of it in all consuming apps. I would like to prevent that for now.

Would it be possible to register the <BsLinkTo> instances in <BsNav> and pass them as an argument to <BsNav::Item> for now?

from ember-bootstrap.

SanderKnauff avatar SanderKnauff commented on July 19, 2024

I'm not sure if that is possible. If we have the <BsNav> register all link-to components, how would we tell which link is inside which <BsNav::Item>.

Considering the following situation:

<BsNav as |nav|>
  <nav.item>
    <nav.link-to>link 1</nav.link-to>
  </nav.item>
  <nav.item>
    <nav.link-to>link 2</nav.link-to>
  </nav.item>
</BsNav>

What could we do from the yield in BsNav to identify which item contains what link?

from ember-bootstrap.

jelhan avatar jelhan commented on July 19, 2024

Got it. Moving to <BsNav> is not possible.

I wonder if it is needed anymore at all. It seems to be used to set active and disabled CSS classes on <li class="nav-item">.

I cannot find having active or disabled CSS class on <li class="nav-item"> for Bootstrap 4 or 5 in Bootstrap's documentation. I can only find it in Bootstrap 3. In Bootstrap 4 and 5 the active and disabled CSS classes are on the <a> element, which is rendered by <BsLinkTo> itself.

Unless I missed something the code seems to be a leftover from Bootstrap 3 support, which we missed to remove. Would be great if you could double check as well.

Assuming I haven't missed something, I would recommend doing 2 PRs:

  1. Removing active and disabled CSS classes from <li class="nav-item"> and all code related to it.
  2. Refactoring <BsNav::Item> to Glimmer component, which should be unblocked after we landed the cleanup in first step.

I prefer two PRs to highlight the markup change more prominently in changelog. I don't think it's a breaking change. I would consider that HTML private implementation detail and not matching markup from Bootstrap docs as a bug. But clearly documenting the change might be good anyways.

from ember-bootstrap.

jelhan avatar jelhan commented on July 19, 2024

Thanks a lot to @SanderKnauff for implementing the @glimmer/component refactoring.

from ember-bootstrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.