File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/components/table/helpers Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { BTd } from '../td'
66import { BTh } from '../th'
77
88const detailsSlotName = 'row-details'
9+ const noop = ( ) => { }
910
1011export default {
1112 props : {
@@ -180,6 +181,8 @@ export default {
180181 const hasDetailsSlot = this . hasNormalizedSlot ( detailsSlotName )
181182 const rowShowDetails = Boolean ( item . _showDetails && hasDetailsSlot )
182183 const hasRowClickHandler = this . $listeners [ 'row-clicked' ] || this . hasSelectableRowClick
184+ const hasRowHoveredHandler = this . $listeners [ 'row-hovered' ]
185+ const hasRowUnhoveredHandler = this . $listeners [ 'row-unhovered' ]
183186
184187 // We can return more than one TR if rowDetails enabled
185188 const $rows = [ ]
@@ -241,8 +244,9 @@ export default {
241244 } ,
242245 on : {
243246 // Note: These events are not A11Y friendly!
244- mouseenter : this . rowHovered ,
245- mouseleave : this . rowUnhovered
247+ // Event handlers only called if there are listeners registered
248+ mouseenter : hasRowHoveredHandler ? this . rowHovered : noop ,
249+ mouseleave : hasRowUnhoveredHandler ? this . rowUnhovered : noop
246250 }
247251 } ,
248252 $tds
You can’t perform that action at this time.
0 commit comments