Skip to content
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

Improve public API for <BsDropdown> #2072

Open
Tracked by #2085
jelhan opened this issue Jan 15, 2024 · 0 comments
Open
Tracked by #2085

Improve public API for <BsDropdown> #2072

jelhan opened this issue Jan 15, 2024 · 0 comments

Comments

@jelhan
Copy link
Contributor

jelhan commented Jan 15, 2024

The public API for <BsDropdown> is currently confusing.

It yields two components to render the dropdown toogle:

  • toggle, which renders a <a> element
  • button, which renders a <button> element

This is problematic for multiple reasons:

  1. Bootstrap documentation recommends using a <button> for the dropdown toogle. A <a> element should be only used in exceptional cases. Due to the current naming, a consumer likely expects that the yielded toggle component should be used by default.
  2. A button can be used in a dropdown menu item. It's likely that a consumer expect that a yielded button component should be used for that. While it only works as dropdown toggle.
  3. Yielding two different components forces the user making an explicit decision if a <button> or <a> element should be used for the toggle. While in nearly all cases a <button> is correct. Ember Bootstrap should simplify mental model for consumers by only yielding one component for the toggle. That component should have an optional argument allowing to render a <a> if needed.

Rendering a <button> instead of a <a> in yielded toggle component is a breaking change. We can only do so in a major release.

I propose the following migration path:

  1. Add an optional as argument to yielded toggle component, which excepts "button" and "a" as arguments. Have it default to "a" in the current major. Switch the default to "button" in the next major.
  2. Deprecate the yielded button component.

As an alternative, we could do both at once in an upcoming major release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant