File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ at a time.
146
146
<div role =" tablist" >
147
147
<b-card no-body class =" mb-1" >
148
148
<b-card-header header-tag =" header" class =" p-1" role =" tab" >
149
- <b-button block href = " # " v-b-toggle.accordion-1 variant =" info" >Accordion 1</b-button >
149
+ <b-button block v-b-toggle.accordion-1 variant =" info" >Accordion 1</b-button >
150
150
</b-card-header >
151
151
<b-collapse id =" accordion-1" visible accordion =" my-accordion" role =" tabpanel" >
152
152
<b-card-body >
@@ -158,7 +158,7 @@ at a time.
158
158
159
159
<b-card no-body class =" mb-1" >
160
160
<b-card-header header-tag =" header" class =" p-1" role =" tab" >
161
- <b-button block href = " # " v-b-toggle.accordion-2 variant =" info" >Accordion 2</b-button >
161
+ <b-button block v-b-toggle.accordion-2 variant =" info" >Accordion 2</b-button >
162
162
</b-card-header >
163
163
<b-collapse id =" accordion-2" accordion =" my-accordion" role =" tabpanel" >
164
164
<b-card-body >
@@ -169,7 +169,7 @@ at a time.
169
169
170
170
<b-card no-body class =" mb-1" >
171
171
<b-card-header header-tag =" header" class =" p-1" role =" tab" >
172
- <b-button block href = " # " v-b-toggle.accordion-3 variant =" info" >Accordion 3</b-button >
172
+ <b-button block v-b-toggle.accordion-3 variant =" info" >Accordion 3</b-button >
173
173
</b-card-header >
174
174
<b-collapse id =" accordion-3" accordion =" my-accordion" role =" tabpanel" >
175
175
<b-card-body >
Original file line number Diff line number Diff line change @@ -90,6 +90,19 @@ trigger element when the target component is closed, and removed when open. As o
90
90
}
91
91
```
92
92
93
+ ## Preventing the target from opening or closing
94
+
95
+ To prevent the trigger element from toggling the target, set the ` disabled ` prop on ` <button> ` ,
96
+ ` <b-button> ` , or ` <b-link> ` and the toggle event will _ not_ dispatched to the target(s).
97
+
98
+ ` v-b-toggle ` also checks if the ` click ` event (and ` keydown ` event for non-button/links) was
99
+ canceled (i.e. via ` event.preventDefault() ` or ` @click.prevent ` ), and if so, it will _ not_ dispatch
100
+ the toggle event to the target(s).
101
+
102
+ Because of this, avoid placing ` v-b-toggle ` on a ` <b-button> ` or ` <b-link> ` that has the ` href ` prop
103
+ set to ` '#' ` , as these components (or components based on them) call ` event.preventDefault() ` to
104
+ stop the browser from scrolling to the top of the page.
105
+
93
106
## Accessibility
94
107
95
108
The directive, for accessibility reasons, should be placed on an clickable interactive element such
You can’t perform that action at this time.
0 commit comments