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

b-dropdown: The ability to set attributes and properties for b-button object #3694

Closed
drakej opened this issue Jul 15, 2019 · 8 comments · Fixed by #3695 or #6339
Closed

b-dropdown: The ability to set attributes and properties for b-button object #3694

drakej opened this issue Jul 15, 2019 · 8 comments · Fixed by #3695 or #6339

Comments

@drakej
Copy link

drakej commented Jul 15, 2019

Is your feature request related to a problem? Please describe...

b-dropdown provides only variant as a way to set attributes and style on the b-button it creates

Describe the solution you'd like

Some way to set properties and attributes on the b-button that's created.

Describe alternatives you've considered

I have not found one which is why I'm filing this request.

Additional context

You need to make sure you don't generate markup and bootstrap components with no flexibility. I'm very concerned that this isn't the only case this plugin breaks or doesn't provide a way to actually use the flexibility of bootstrap itself.

@tmorehouse
Copy link
Member

Which button's are you referring too, the generated toggle button (which is rendered either as a button, or a link when in navbar), or the b-dropdown-item-button?

@drakej
Copy link
Author

drakej commented Jul 15, 2019

The generated toggle button. Sorry should have made that clear. I haven't found a way I can actually set for example type="reset" instead of type="button" on that generated markup.

@tmorehouse
Copy link
Member

You can specify toggle-class prop to add custom classes to the dropdowns trigger button.

When you want to set type = 'reset', I am assuming you are referring to a split dropdown button?

@tmorehouse
Copy link
Member

If you are looking to reset a form using a split button, you can add a click listener which then invokes the reset() method of a <form> element (https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reset)

@drakej
Copy link
Author

drakej commented Jul 15, 2019

Good idea, I didn't think of that workaround, but ya that's what I'm trying to do. Was hoping to find a way to set an attribute that would affect the generated markup directly.

@tmorehouse
Copy link
Member

We might be able to add in a split-button-type prop which defaults to button (as long as there is no split-to or split-href prop set). And allows only types button, submit, reset

@drakej
Copy link
Author

drakej commented Jul 15, 2019

$el.ownerDocument.getElementById('filter_form').reset()
^ This worked putting this in @click on the b-dropdown tag

@tmorehouse
Copy link
Member

Bootstrap v2.0.0-rc.27 has been released

jacobmllr95 added a commit that referenced this issue Jan 21, 2021
* feat(b-dropdown): add `toggle-attrs` prop

Add `toggle-attrs` prop to allow adding HTML attributes to the
dropdown toggle

* Update dropdown.js

* Update dropdown.spec.js

Co-authored-by: peterhegman <phegman@gitlab.com>
Co-authored-by: Jacob Müller <jacob.mueller.elz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment