Skip to content

fix(ButtonIcon): drop tooltip defaults that shadow global BTooltip config - #21

Closed
lschim wants to merge 1 commit into
mainfrom
fix/button-icon-tooltip-defaults
Closed

lschim wants to merge 1 commit into
mainfrom
fix/button-icon-tooltip-defaults

Conversation

@lschim

@lschim lschim commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Problem

ButtonIcon declares hardcoded defaults for two tooltip props:

tooltipPlacement: 'top',
tooltipDelay: () => ({ show: 0, hide: 0 }),

It then forwards them unconditionally to its <b-tooltip>. bootstrap-vue-next resolves a globally configured default only when a prop is absent from the vnode (propIsDefined in useDefaults), so a concrete value passed here permanently shadows it.

The practical effect in a consuming app: configuring tooltips globally is a no-op for every button.

createBootstrap({ components: { BTooltip: { delay: { show: 3000, hide: 0 } } } })

Every ButtonIcon keeps { show: 0, hide: 0 }. Since ButtonIcon is the base button of downstream applications, this covers most tooltips in them. We hit this in datashare-client while trying to set an application-wide hover delay.

Fix

Remove both defaults. BTooltip then applies its own, and a global default wins when one is configured. Callers passing tooltip-placement or tooltip-delay explicitly are unaffected.

Behaviour

tooltipPlacement is strictly neutral: BPopover already defaults placement to 'top'.

tooltipDelay is neutral for the main button tooltip (BTooltip declares delay: 0), with one intentional exception. The iconLeftLabel / iconRightLabel tooltips use the v-b-tooltip directive, which renders a BPopover directly, and BPopover defaults delay to { show: 100, hide: 300 }. Measured on the timer useShowHide actually schedules:

show delay on hover
before 0 ms
after 100 ms

100 ms is bootstrap-vue-next's intended default and is imperceptible, but it is a real change and can now be overridden globally, which was the point.

Tests

New tests/unit/components/Button/ButtonIconTooltip.spec.ts asserts the props reaching the tooltip vnode, plus one integration test proving a globally configured BTooltip delay now reaches the rendered BPopover. Three of the five tests fail without the change.

Full suite: 856 tests passing, lint clean, build:lib clean.

…nfig

`tooltipPlacement` and `tooltipDelay` were declared with hardcoded defaults
(`'top'` and `{ show: 0, hide: 0 }`), so ButtonIcon always passed a concrete
value down to its BTooltip.

bootstrap-vue-next only falls back to a globally configured default when a
prop is absent from the vnode, so those defaults made
`createBootstrap({ components: { BTooltip: { ... } } })` a no-op for every
ButtonIcon in a consuming application: the global value was resolved, then
immediately shadowed.

Leaving both props unset lets BTooltip apply its own defaults while staying
globally configurable. Callers passing either prop explicitly are unaffected.
@lschim lschim closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant