Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Sep 15, 2025

When a BButton or BDropdown with v-b-tooltip is placed as the last element in a BButtonGroup, the right-side border radius disappears, breaking the visual consistency of the button group.

Root Cause

The issue occurs because the tooltip directive inserts a <span> element as the next sibling of the button element. This breaks Bootstrap's CSS :last-child selectors that apply border-radius to the last button in a group:

Before fix:

<div class="btn-group">
  <button>First</button>
  <button>Last with tooltip</button>  <!-- NOT :last-child ❌ -->
  <span><!-- tooltip container --></span>  <!-- Now this is :last-child -->
</div>

Solution

Modified the vBTooltip directive to automatically detect when an element is inside a button group (using the existing buttonGroupKey injection) and use body placement for tooltips in button groups. This prevents DOM interference while maintaining full tooltip functionality.

After fix:

<div class="btn-group">
  <button>First</button> 
  <button>Last with tooltip</button>  <!-- :last-child ✅ -->
</div>
<!-- Tooltip rendered in document.body instead -->

Changes

  • Enhanced vBTooltip directive to detect button group context
  • Automatically apply body placement when inside button groups
  • Added comprehensive test coverage for button group scenarios
  • Maintains backward compatibility for all existing tooltip usage

Visual Result

Button groups with proper rounded corners

All button groups now maintain proper rounded corners regardless of tooltip placement, while tooltips remain fully functional.

Fixes #1911.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Co-authored-by: VividLemon <31498096+VividLemon@users.noreply.github.com>
Copilot AI changed the title [WIP] Buttongroup: last button/dropdown loses rounding if using v-b-tooltip Fix tooltip directive interfering with button group styling Sep 15, 2025
Copilot finished work on behalf of VividLemon September 15, 2025 13:55
Copilot AI requested a review from VividLemon September 15, 2025 13:55
@github-actions
Copy link
Contributor

This PR is stale because it has been open for 45 days with no activity. It will not be auto-closed

@github-actions github-actions bot added the stale There has been no additional replies or questions and the thread is assumed closed label Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale There has been no additional replies or questions and the thread is assumed closed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buttongroup: last button/dropdown loses rounding if using v-b-tooltip

2 participants