]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix `.btn-group-vertical` border radius with dropdown as first element (#40488)
authorTobias <t@tobiasjordans.de>
Thu, 30 May 2024 05:49:28 +0000 (07:49 +0200)
committerGitHub <noreply@github.com>
Thu, 30 May 2024 05:49:28 +0000 (07:49 +0200)
Co-authored-by: Julien Déramond <juderamond@gmail.com>
scss/_button-group.scss
site/content/docs/5.3/components/button-group.md

index 55ae3f65d25547c6b18a0392b225b86b6bcb1427..dcd2a858ed93990d59b6c1a8cfb267489725c83a 100644 (file)
     @include border-bottom-radius(0);
   }
 
-  > .btn ~ .btn,
+  // The top radius should be 0 if the button is:
+  // - the "third or more" child
+  // - the second child and the previous element isn't `.btn-check` (making it the first child visually)
+  // - part of a btn-group which isn't the first child
+  > .btn:nth-child(n + 3),
+  > :not(.btn-check) + .btn,
   > .btn-group:not(:first-child) > .btn {
     @include border-top-radius(0);
   }
index 9f26a9181b121c785de93f8d8020c573f8e1f59b..545467feca4abef8ab29c1b5b530245bfec8ef55 100644 (file)
@@ -195,8 +195,6 @@ Make a set of buttons appear vertically stacked rather than horizontally. **Spli
 
 {{< example >}}
 <div class="btn-group-vertical" role="group" aria-label="Vertical button group">
-  <button type="button" class="btn btn-primary">Button</button>
-  <button type="button" class="btn btn-primary">Button</button>
   <div class="btn-group" role="group">
     <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
       Dropdown
@@ -206,6 +204,8 @@ Make a set of buttons appear vertically stacked rather than horizontally. **Spli
       <li><a class="dropdown-item" href="#">Dropdown link</a></li>
     </ul>
   </div>
+  <button type="button" class="btn btn-primary">Button</button>
+  <button type="button" class="btn btn-primary">Button</button>
   <div class="btn-group dropstart" role="group">
     <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
       Dropdown